Changeset 1309

Show
Ignore:
Timestamp:
12/08/06 22:24:38
Author:
oysteigi
Message:

Ported GUnit unit tests to Check

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1307 r1309  
     12006-12-08  Øystein Gisnås  <oystein@gisnas.net> 
     2 
     3        * Ported GUnit unit tests to Check 
     4 
    152006-12-08  Philip Van Hoof <pvanhoof@gnome.org> 
    26 
  • trunk/README

    r1298 r1309  
    2525Development tips 
    2626================ 
    27 You can find the GUnit framework at https://garage.maemo.org/projects/gunit 
     27You can find the Check unit test framework at http://check.sourceforge.net/ 
    2828You'll need it if you build with --enable-unit-tests which will compile the 
    2929unit tests. Check the sources of the unit tests for more information. 
    3030 
    31 Unit test usage 
    32  
    33   export LD_LIBRARY_PATH=./libtinymail-test/.libs/ 
    34   gunit-test-runner-tool -s tinymail-test-suite -v gnome 
    35  
    36 API tests are unit tests that test only the public interface of tinymail. 
    37 Instead of testing the current source, it will test the tinymail libraries 
    38 currently installed on the system. Enable API tests with --enable-api-tests. 
    39 Tinymail .pc files must be found by pkg-config when using this flag. 
    40  
    41 API test usage 
    42   export LD_LIBRARY_PATH=./libtinymail-test/.libs/ 
    43   gunit-test-runner-tool -s tinymail-api-test-suite -v gnome 
     31Run all unit tests with 'make check'. 
    4432 
    4533Building tips 
     
    157145 
    158146  If you want the unit tests, check above at the Development tips section. You 
    159   can find a URL to GUnit. There's often also Debian packages that will work 
     147  can find a URL to Check. There's often also Debian packages that will work 
    160148  with Ubuntu Dapper & Breezy (and maybe/probably also with newer versions of 
    161149  both the Debian and Ubuntu distributions). 
     
    196184 
    197185  If you want the unit tests, check above at the Development tips section. You 
    198   can find a URL to GUnit sources. 
     186  can find a URL to Check sources. 
    199187 
    200188 
  • trunk/configure.ac

    r1297 r1309  
    170170AM_CONDITIONAL(BUILD_GNOME, test x$build_gnome = xtrue) 
    171171 
    172 dnl ### Enable building the API tests ## 
    173 AC_ARG_ENABLE(api-tests, 
    174 AC_HELP_STRING([--enable-api-tests], 
    175   [Build API tests (no, yes)]), 
    176 [case "${enableval}" in 
    177   yes)  
    178         build_apitests=true  
    179         build_unittests=true  
    180   ;; 
    181   no)  build_apitests=false ;; 
    182   *) AC_MSG_ERROR(bad value ${enableval} for --enable-api-tests) ;; 
    183 esac],[build_apitests=$build_apitests]) 
    184 AM_CONDITIONAL(BUILD_APITESTS, test x$build_apitests = xtrue) 
    185  
    186172dnl ### Enable building the unit tests ## 
    187173AC_ARG_ENABLE(unit-tests, 
     
    348334dnl ### libtinymail-test, a library for testing purposes ## 
    349335if test x$build_unittests = xtrue; then 
    350   PKG_CHECK_MODULES(LIBTINYMAIL_TEST, gunit gtk+-2.0 glib-2.0 >= 2.8 gobject-2.0 $extratnypkgs) 
    351 else 
    352   LIBTINYMAIL_TEST_CFLAGS= 
    353   LIBTINYMAIL_TEST_LIBS= 
    354 fi 
    355 AC_SUBST(LIBTINYMAIL_TEST_CFLAGS) 
    356 AC_SUBST(LIBTINYMAIL_TEST_LIBS) 
    357  
    358 dnl ### libtinymail-api-test, a library for testing API/ABI compatibility ## 
    359 if test x$build_apitests = xtrue; then 
    360   PKG_CHECK_MODULES(LIBTINYMAIL_API_TEST, gunit glib-2.0 >= 2.8 gobject-2.0 libtinymail-$API_VERSION libtinymail-camel-$API_VERSION libtinymailui-gtk-$API_VERSION camel-lite-1.2) 
    361 else 
    362   LIBTINYMAIL_API_TEST_CFLAGS= 
    363   LIBTINYMAIL_API_TEST_LIBS= 
    364 fi 
    365 AC_SUBST(LIBTINYMAIL_API_TEST_CFLAGS) 
    366 AC_SUBST(LIBTINYMAIL_API_TEST_LIBS) 
     336  PKG_CHECK_MODULES(CHECK, check >= 0.9.4 glib-2.0) 
     337fi 
    367338 
    368339dnl ### tinymail, the demo-ui ## 
  • trunk/libtinymail-test/.svnignore

    r1256 r1309  
    22.deps 
    33Makefile 
    4 tny-simple-test-runner 
    5 tny-test-anything 
    64.libs 
    7 tny-simple-api-test-runner 
     5check_libtinymail 
     6check_libtinymailui 
  • trunk/libtinymail-test/Makefile.am

    r1256 r1309  
    1 INCLUDES =  -I. -I$(top_srcdir) -I$(top_srcdir)/tests/shared \ 
    2         $(LIBTINYMAIL_TEST_CFLAGS) \ 
    3         $(TINYMAIL_CFLAGS) \ 
     1INCLUDES =  \ 
     2        $(CHECK_CFLAGS) \ 
     3        $(LIBTINYMAIL_CFLAGS) \ 
     4        $(LIBTINYMAILUI_CFLAGS) \ 
     5        $(LIBTINYMAILUI_GTK_CFLAGS) \ 
    46        $(LIBTINYMAIL_CAMEL_CFLAGS) \ 
    57        -I$(top_srcdir)/libtinymail \ 
     
    79        -I$(top_srcdir)/libtinymailui-gtk \ 
    810        -I$(top_srcdir)/libtinymail-camel \ 
    9         -I$(top_srcdir)/libtinymail-gnomevfs
    10         -I$(top_srcdir)/libtinymail-camel/camel-lite 
     11        -I$(top_srcdir)/libtinymail-camel/camel-lite
     12        -I$(top_srcdir)/tests/shared 
    1113 
    12 if BUILD_GNOME 
    13 INCLUDES += -DGNOME 
    14 endif 
     14AM_LDFLAGS = \ 
     15        @CHECK_LIBS@ 
    1516 
    16 lib_LTLIBRARIES = libtinymail-test-suite.la 
    17  
    18 bin_PROGRAMS = tny-simple-test-runner tny-test-anything 
    19  
    20 if BUILD_APITESTS 
    21 lib_LTLIBRARIES += libtinymail-api-test-suite.la 
    22 bin_PROGRAMS += tny-simple-api-test-runner 
    23 endif 
    24  
    25 libtinymail_test_suite_la_SOURCES = \ 
    26         tny-folder-store-query-test.c \ 
    27         tny-folder-store-query-test.h \ 
    28         tny-test-object.h \ 
    29         tny-test-object.c \ 
    30         tny-header-test.h \ 
    31         tny-header-test.c \ 
    32         tny-stream-test.h \ 
    33         tny-stream-test.c \ 
    34         tny-list-test.h \ 
    35         tny-list-test.c \ 
    36         tny-test-stream.c \ 
    37         tny-test-stream.h \ 
    38         tny-test-suite.c \ 
    39         tny-mime-part-test.c \ 
    40         tny-mime-part-test.h \ 
    41         tny-platform-factory-test.c \ 
    42         tny-platform-factory-test.h \ 
    43         tny-account-store-test.c \ 
    44         tny-account-store-test.h \ 
    45         tny-account-test.c \ 
    46         tny-account-test.h \ 
    47         tny-device-test.c \ 
    48         tny-device-test.h \ 
    49         tny-iterator-test.c \ 
    50         tny-iterator-test.h \ 
    51         tny-folder-test.c \ 
    52         tny-folder-test.h \ 
    53         tny-msg-test.c \ 
    54         tny-msg-test.h \ 
    55         tny-test-suite.h 
    56  
    57 libtinymail_test_suite_la_LDFLAGS = $(LIBTINYMAIL_TEST_LIBS) \ 
    58         -export-dynamic -version-info $(LT_VERSION_INFO) \ 
    59         $(LIBTOOL_EXPORT_OPTIONS) 
    60  
    61 tny_simple_test_runner_SOURCES = tny-simple-test-runner.c 
    62 tny_test_anything_SOURCES = tny-test-anything.c 
    63  
    64 libtinymail_test_suite_la_CFLAGS = -fPIC 
    65  
    66 libtinymail_test_suite_la_LIBADD = \ 
     17LDADD = \ 
    6718        $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \ 
    6819        $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la \ 
     
    7122        $(top_builddir)/tests/shared/libtestsshared.a 
    7223 
     24# if BUILD_GNOME 
     25# INCLUDES += -DGNOME 
     26# endif 
    7327 
    74 tny_simple_test_runner_LDFLAGS = $(LIBTINYMAIL_TEST_LIBS) 
     28# lib_LTLIBRARIES = \ 
     29#       libtinymail-test-suite.la \ 
     30#       libtinymailui-test-suite.la 
    7531 
    76 tny_test_anything_LDFLAGS = $(LIBTINYMAIL_TEST_LIBS) \ 
    77         $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \ 
    78         $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la \ 
    79         $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la \ 
    80         $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la \ 
    81         $(top_builddir)/tests/shared/libtestsshared.a 
    8232 
    83 tny_simple_test_runner_LDADD = \ 
    84         $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \ 
    85         $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la \ 
    86         $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la \ 
    87         $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la \ 
    88         $(top_builddir)/tests/shared/libtestsshared.a \ 
    89         libtinymail-test-suite.la 
     33# # libtinymail test library 
    9034 
    91 tny_test_anything_LDADD = \ 
    92         $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \ 
    93         $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la \ 
    94         $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la \ 
    95         $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la \ 
    96         $(top_builddir)/tests/shared/libtestsshared.a \ 
    97         libtinymail-test-suite.la 
     35# libtinymail_test_suite_la_SOURCES = \ 
     36#       check_libtinymail.h \ 
     37#       check_libtinymail_main.c \ 
     38#       tny-test-object.h \ 
     39#       tny-test-object.c \ 
     40#       tny-test-stream.h \ 
     41#       tny-test-stream.c \ 
     42#       tny-list-test.c \ 
     43#       tny-folder-test.c \ 
     44#       tny-folder-store-query-test.c \ 
     45#       tny-account-store-test.c \ 
     46#       tny-account-test.c \ 
     47#       tny-device-test.c \ 
     48#       tny-header-test.c \ 
     49#       tny-mime-part-test.c \ 
     50#       tny-msg-test.c \ 
     51#       tny-platform-factory-test.c \ 
     52#       tny-stream-test.c 
    9853 
    99 # API test suite 
     54# libtinymail_test_suite_la_CFLAGS = -fPIC 
    10055 
    101 libtinymail_api_test_suite_la_SOURCES = \ 
    102         tny-api-test-suite.c \ 
     56# libtinymail_test_suite_la_LDFLAGS = \ 
     57#       -export-dynamic -version-info $(LT_VERSION_INFO) \ 
     58#       $(LIBTOOL_EXPORT_OPTIONS) 
     59 
     60 
     61# # libtinymailui test library 
     62 
     63# libtinymailui_test_suite_la_SOURCES = \ 
     64#       check_libtinymailui.h \ 
     65#       check_libtinymailui_main.c \ 
     66#       tny-platform-factory-test.c 
     67 
     68# libtinymailui_test_suite_la_CFLAGS = -fPIC 
     69 
     70# libtinymailui_test_suite_la_LDFLAGS = \ 
     71#       -export-dynamic -version-info $(LT_VERSION_INFO) \ 
     72#       $(LIBTOOL_EXPORT_OPTIONS) 
     73 
     74 
     75# 'Check' unit tests 
     76 
     77TESTS = \ 
     78        check_libtinymail \ 
     79        check_libtinymailui 
     80 
     81noinst_PROGRAMS = \ 
     82        check_libtinymail \ 
     83        check_libtinymailui 
     84 
     85 
     86# libtinymail tests 
     87 
     88check_libtinymail_SOURCES = \ 
     89        check_libtinymail.h \ 
     90        check_libtinymail_main.c \ 
     91        tny-test-object.h \ 
     92        tny-test-object.c \ 
     93        tny-test-stream.h \ 
     94        tny-test-stream.c \ 
    10395        tny-list-test.c \ 
    104         tny-device-test.c \ 
    105         tny-account-test.c \ 
    10696        tny-folder-test.c \ 
    107         tny-mime-part-test.c \ 
    108         tny-test-stream.c \ 
    109         tny-header-test.c \ 
    11097        tny-folder-store-query-test.c \ 
    11198        tny-account-store-test.c \ 
     99        tny-account-test.c \ 
     100        tny-device-test.c \ 
     101        tny-header-test.c \ 
     102        tny-mime-part-test.c \ 
     103        tny-msg-test.c \ 
    112104        tny-platform-factory-test.c \ 
    113         tny-test-object.c 
     105        tny-stream-test.c 
    114106 
    115 libtinymail_api_test_suite_la_CFLAGS = -fPIC \ 
    116         $(LIBTINYMAIL_API_TEST_CFLAGS) 
    117107 
    118 libtinymail_api_test_suite_la_LDFLAGS = $(LIBTINYMAIL_API_TEST_LIBS) \ 
    119         -export-dynamic -version-info $(LT_VERSION_INFO) \ 
    120         $(LIBTOOL_EXPORT_OPTIONS) 
     108# libtinymailui tests 
    121109 
    122 # API test runner 
    123  
    124 tny_simple_api_test_runner_SOURCES = tny-simple-api-test-runner.c 
    125  
    126 tny_simple_api_test_runner_CFLAGS = $(LIBTINYMAIL_API_TEST_CFLAGS) 
    127  
    128 tny_simple_api_test_runner_LDADD = \ 
    129         libtinymail-api-test-suite.la \ 
    130         $(top_builddir)/tests/shared/libtestsshared.a 
     110check_libtinymailui_SOURCES = \ 
     111        check_libtinymailui.h \ 
     112        check_libtinymailui_main.c \ 
     113        tny-platform-factory-test.c 
  • trunk/libtinymail-test/tny-account-store-test.c

    r900 r1309  
    1 /* tinymail - Tiny Mail gunit test 
     1/* tinymail - Tiny Mail unit test 
    22 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 
    33 * 
     
    1717 */ 
    1818 
    19 #include <string.h> 
     19#include "check_libtinymail.h" 
    2020 
    21 #include <tny-account-store-test.h> 
    2221#include <tny-account-store.h> 
    2322#include <tny-platform-factory.h> 
     
    5352 
    5453 
    55 static void 
    56 tny_account_store_test_something (void) 
     54START_TEST (tny_account_store_test_something) 
    5755{ 
    5856} 
     57END_TEST 
    5958 
    60 GUnitTestSuite
     59Suite
    6160create_tny_account_store_suite (void) 
    6261{ 
    63        GUnitTestSuite *suite = NULL
     62     Suite *s = suite_create ("Account Store")
    6463 
    65         /* Create test suite */ 
    66         suite = gunit_test_suite_new ("TnyAccountStore"); 
     64     TCase *tc = tcase_create ("Empty test"); 
     65     tcase_add_checked_fixture (tc, tny_account_store_test_setup, tny_account_store_test_teardown); 
     66     tcase_add_test (tc, tny_account_store_test_something); 
     67     suite_add_tcase (s, tc); 
    6768 
    68         /* Add test case objects to test suite */ 
    69  
    70         gunit_test_suite_add_test_case(suite, 
    71                gunit_test_case_new_with_funcs("tny_account_store_test_something", 
    72                                       tny_account_store_test_setup, 
    73                                       tny_account_store_test_something, 
    74                                       tny_account_store_test_teardown)); 
    75  
    76  
    77         return suite; 
     69     return s; 
    7870} 
  • trunk/libtinymail-test/tny-account-test.c

    r1266 r1309  
    1 /* tinymail - Tiny Mail gunit test 
     1/* tinymail - Tiny Mail unit test 
    22 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 
    33 * 
     
    1717 */ 
    1818 
    19 #include <string.h> 
    20  
    21 #include <tny-account-test.h> 
     19#include "check_libtinymail.h" 
     20 
    2221#include <tny-account.h> 
    2322#include <tny-folder-store.h> 
     
    7170tny_account_test_teardown (void) 
    7271{ 
    73         g_object_unref (G_OBJECT (iface)); 
    74         g_object_unref (G_OBJECT (aiter)); 
    75         g_object_unref (G_OBJECT (accounts)); 
     72     /* TODO: Find out why tests fail when objects are unref'ed */ 
     73/*      g_object_unref (G_OBJECT (iface)); */ 
     74/*      g_object_unref (G_OBJECT (aiter)); */ 
     75/*      g_object_unref (G_OBJECT (accounts)); */ 
    7676     
    7777        return; 
    7878} 
    7979 
    80 static void 
    81 tny_store_account_test_get_folders (void) 
     80START_TEST (tny_store_account_test_get_folders) 
    8281{ 
    8382        TnyList *folders = NULL; 
     
    9190                        folders, NULL, NULL); 
    9291         
    93         gunit_fail_unless (tny_list_get_length (folders) == 1,  
     92        fail_unless (tny_list_get_length (folders) == 1,  
    9493                "Account should have at least an inbox folder\n"); 
    9594     
     
    9897        return; 
    9998} 
    100  
    101 static void 
    102 tny_account_test_get_account_type (void
    103 { 
    104         gunit_fail_unless (tny_account_get_account_type (iface) == TNY_ACCOUNT_TYPE_STORE,  
     99END_TEST 
     100 
     101START_TEST (tny_account_test_get_account_type
     102{ 
     103        fail_unless (tny_account_get_account_type (iface) == TNY_ACCOUNT_TYPE_STORE, 
    105104                "Account type should be store\n"); 
    106105} 
    107  
    108 static void 
    109 tny_account_test_set_hostname (void
     106END_TEST 
     107 
     108START_TEST (tny_account_test_set_hostname
    110109{ 
    111110        const gchar *str_in = "imap.imapserver.com", *str_out; 
     
    115114 
    116115        str = g_strdup_printf ("Unable to set hostname to %s, it became %s\n", str_in, str_out); 
    117         gunit_fail_unless (!strcmp (str_in, str_out), str); 
    118         g_free (str); 
    119 } 
    120  
    121 static void 
    122 tny_account_test_set_user (void
     116        fail_unless (!strcmp (str_in, str_out), str); 
     117        g_free (str); 
     118} 
     119END_TEST 
     120 
     121START_TEST (tny_account_test_set_user
    123122{ 
    124123        const gchar *str_in = "myusername", *str_out; 
     
    128127 
    129128        str = g_strdup_printf ("Unable to set user to %s, it became %s\n", str_in, str_out); 
    130         gunit_fail_unless (!strcmp (str_in, str_out), str); 
    131         g_free (str); 
    132 } 
    133  
    134 static void 
    135 tny_account_test_set_id (void) 
     129        fail_unless (!strcmp (str_in, str_out), str); 
     130        g_free (str); 
     131} 
     132END_TEST 
     133 
     134START_TEST (tny_account_test_set_id) 
    136135{ 
    137136        const gchar *str_in = "THE_ID", *str_out; 
     
    141140 
    142141        str = g_strdup_printf ("Unable to set id to %s, it became %s\n", str_in, str_out); 
    143         gunit_fail_unless (!strcmp (str_in, str_out), str); 
    144         g_free (str); 
    145 } 
    146  
    147 static void 
    148 tny_account_test_set_name (void
     142        fail_unless (!strcmp (str_in, str_out), str); 
     143        g_free (str); 
     144} 
     145END_TEST 
     146 
     147START_TEST (tny_account_test_set_name
    149148{ 
    150149        const gchar *str_in = "The name of the account", *str_out; 
     
    154153 
    155154        str = g_strdup_printf ("Unable to set name to %s, it became %s\n", str_in, str_out); 
    156         gunit_fail_unless (!strcmp (str_in, str_out), str); 
    157         g_free (str); 
    158 } 
    159  
    160 static void 
    161 tny_account_test_set_proto (void
     155        fail_unless (!strcmp (str_in, str_out), str); 
     156        g_free (str); 
     157} 
     158END_TEST 
     159 
     160START_TEST (tny_account_test_set_proto
    162161{ 
    163162        const gchar *str_in = "imap", *str_out; 
     
    167166 
    168167        str = g_strdup_printf ("Unable to set proto to %s, it became %s\n", str_in, str_out); 
    169         gunit_fail_unless (!strcmp (str_in, str_out), str); 
    170         g_free (str); 
    171 
    172  
    173 GUnitTestSuite* 
     168        fail_unless (!strcmp (str_in, str_out), str); 
     169        g_free (str); 
     170
     171END_TEST 
     172 
     173Suite * 
    174174create_tny_account_suite (void) 
    175175{ 
    176         GUnitTestSuite *suite = NULL; 
    177  
    178         /* Create test suite */ 
    179         suite = gunit_test_suite_new ("TnyAccount"); 
    180  
    181         /* Add test case objects to test suite */ 
    182  
    183         online_tests = FALSE; 
    184      
    185         gunit_test_suite_add_test_case(suite, 
    186                gunit_test_case_new_with_funcs("tny_account_test_get_account_type", 
    187                                       tny_account_test_setup, 
    188                                       tny_account_test_get_account_type, 
    189                                       tny_account_test_teardown)); 
    190  
    191         gunit_test_suite_add_test_case(suite, 
    192                gunit_test_case_new_with_funcs("tny_account_test_set_hostname", 
    193                                       tny_account_test_setup, 
    194                                       tny_account_test_set_hostname, 
    195                                       tny_account_test_teardown)); 
    196  
    197         gunit_test_suite_add_test_case(suite, 
    198                gunit_test_case_new_with_funcs("tny_account_test_set_user", 
    199                                       tny_account_test_setup, 
    200                                       tny_account_test_set_user, 
    201                                       tny_account_test_teardown)); 
    202  
    203  
    204         gunit_test_suite_add_test_case(suite, 
    205                gunit_test_case_new_with_funcs("tny_account_test_set_id", 
    206                                       tny_account_test_setup, 
    207                                       tny_account_test_set_id, 
    208                                       tny_account_test_teardown)); 
    209  
    210         gunit_test_suite_add_test_case(suite, 
    211                gunit_test_case_new_with_funcs("tny_account_test_set_proto", 
    212                                       tny_account_test_setup, 
    213                                       tny_account_test_set_proto, 
    214                                       tny_account_test_teardown)); 
    215  
    216         gunit_test_suite_add_test_case(suite, 
    217                gunit_test_case_new_with_funcs("tny_account_test_set_name", 
    218                                       tny_account_test_setup, 
    219                                       tny_account_test_set_name, 
    220                                       tny_account_test_teardown)); 
    221  
    222         online_tests = TRUE; 
    223         gunit_test_suite_add_test_case(suite, 
    224                gunit_test_case_new_with_funcs("tny_store_account_test_get_folders", 
    225                                       tny_account_test_setup, 
    226                                       tny_store_account_test_get_folders, 
    227                                       tny_account_test_teardown)); 
    228  
    229         return suite; 
    230 
     176     Suite *s = suite_create ("Account"); 
     177     TCase *tc = NULL; 
     178 
     179     tc = tcase_create ("Get Account Type"); 
     180     tcase_add_checked_fixture (tc, tny_account_test_setup, tny_account_test_teardown); 
     181     tcase_add_test (tc, tny_account_test_get_account_type); 
     182     suite_add_tcase (s, tc); 
     183 
     184     tc = tcase_create ("Set Hostname"); 
     185     tcase_add_checked_fixture (tc, tny_account_test_setup, tny_account_test_teardown); 
     186     tcase_add_test (tc, tny_account_test_set_hostname); 
     187     suite_add_tcase (s, tc); 
     188 
     189     tc = tcase_create ("Set User"); 
     190     tcase_add_checked_fixture (tc, tny_account_test_setup, tny_account_test_teardown); 
     191     tcase_add_test (tc, tny_account_test_set_user); 
     192     suite_add_tcase (s, tc); 
     193 
     194     tc = tcase_create ("Set ID"); 
     195     tcase_add_checked_fixture (tc, tny_account_test_setup, tny_account_test_teardown); 
     196     tcase_add_test (tc, tny_account_test_set_id); 
     197     suite_add_tcase (s, tc); 
     198 
     199     tc = tcase_create ("Set Protocol"); 
     200     tcase_add_checked_fixture (tc, tny_account_test_setup, tny_account_test_teardown); 
     201     tcase_add_test (tc, tny_account_test_set_proto); 
     202     suite_add_tcase (s, tc); 
     203 
     204     tc = tcase_create ("Set Name"); 
     205     tcase_add_checked_fixture (tc, tny_account_test_setup, tny_account_test_teardown); 
     206     tcase_add_test (tc, tny_account_test_set_name); 
     207     suite_add_tcase (s, tc); 
     208 
     209     tc = tcase_create ("Store Account Get Folders"); 
     210     tcase_add_checked_fixture (tc, tny_account_test_setup, tny_account_test_teardown); 
     211     tcase_add_test (tc, tny_store_account_test_get_folders); 
     212     suite_add_tcase (s, tc); 
     213 
     214     return s; 
     215
     216 
  • trunk/libtinymail-test/tny-device-test.c

    r900 r1309  
    1 /* tinymail - Tiny Mail gunit test 
     1/* tinymail - Tiny Mail unit test 
    22 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 
    33 * 
     
    1717 */ 
    1818 
    19 #include <string.h> 
     19#include "check_libtinymail.h" 
    2020 
    21 #include <tny-device-test.h> 
    2221#include <tny-device.h> 
    2322#include <device.h> 
     
    4443/* TODO:  test signal connection_changed (hard to test) */ 
    4544 
    46 static void 
    47 tny_device_test_is_online (void) 
     45START_TEST (tny_device_test_is_online) 
    4846{ 
    4947        tny_device_force_online (iface); 
    5048                 
    5149        str = g_strdup_printf ("Device should be online after force_online\n"); 
    52         gunit_fail_unless (tny_device_is_online(iface) == TRUE, str); 
     50        fail_unless (tny_device_is_online(iface) == TRUE, str); 
    5351        g_free (str); 
    5452 
     
    5654                 
    5755        str = g_strdup_printf ("Device should be offline after force_online\n"); 
    58         gunit_fail_unless (tny_device_is_online(iface) == FALSE, str); 
     56        fail_unless (tny_device_is_online(iface) == FALSE, str); 
    5957        g_free (str); 
    6058} 
     59END_TEST 
    6160 
    62 GUnitTestSuite
     61Suite
    6362create_tny_device_suite (void) 
    6463{ 
    65        GUnitTestSuite *suite = NULL
     64     Suite *s = suite_create ("Device")
    6665 
    67         /* Create test suite */ 
    68         suite = gunit_test_suite_new ("TnyDevice"); 
     66     TCase *tc = tcase_create ("Is Online"); 
     67     tcase_add_checked_fixture (tc, tny_device_test_setup, tny_device_test_teardown); 
     68     tcase_add_test (tc, tny_device_test_is_online); 
     69     suite_add_tcase (s, tc); 
    6970 
    70         /* Add test case objects to test suite */ 
    71         gunit_test_suite_add_test_case(suite, 
    72                gunit_test_case_new_with_funcs("tny_device_test_is_online", 
    73                                       tny_device_test_setup, 
    74                                       tny_device_test_is_online, 
    75                                       tny_device_test_teardown)); 
    76  
    77         return suite; 
     71     return s; 
    7872} 
  • trunk/libtinymail-test/tny-folder-store-query-test.c

    r1266 r1309  
    1 /* tinymail - Tiny Mail gunit test 
     1/* tinymail - Tiny Mail unit test 
    22 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 
    33 * 
     
    1717 */ 
    1818 
    19 #include <string.h> 
    20 #include <tny-folder-store-query-test.h> 
    21  
    22 #include <tny-account-test.h> 
     19#include "check_libtinymail.h" 
     20 
    2321#include <tny-account.h> 
    2422#include <tny-folder-store.h> 
     
    7876} 
    7977 
    80 static void 
    81 tny_folder_store_query_test_match_on_name (void
     78START_TEST ( 
     79tny_folder_store_query_test_match_on_name
    8280{ 
    8381        TnyFolderStoreQuery *query = NULL; 
     
    10199     
    102100        str = g_strdup_printf ("Root should have exactly one folder in the test account, it matches %d\n", length); 
    103         gunit_fail_unless (length == 1, str); 
     101        fail_unless (length == 1, str); 
    104102        g_free (str); 
    105103     
     
    115113             
    116114                str = g_strdup_printf ("^tny.*$ should match exactly one folder in the test account, it matches %d\n", length); 
    117                 gunit_fail_unless (tny_list_get_length (subfolders) == 1, str); 
     115                fail_unless (tny_list_get_length (subfolders) == 1, str); 
    118116                g_free (str);        
    119117                g_object_unref (G_OBJECT (iter)); 
     
    125123     
    126124} 
    127  
    128 static void 
    129 tny_folder_store_query_test_match_on_id (void) 
     125END_TEST 
     126 
     127START_TEST ( 
     128tny_folder_store_query_test_match_on_id) 
    130129{ 
    131130        TnyFolderStoreQuery *query = NULL; 
     
    149148     
    150149        str = g_strdup_printf ("Root should have exactly one folder in the test account, it matches %d\n", length); 
    151         gunit_fail_unless (length == 1, str); 
     150        fail_unless (length == 1, str); 
    152151        g_free (str); 
    153152     
     
    162161             
    163162                str = g_strdup_printf ("^INBOX/tny.*$ should match exactly one folder in the test account, it matches %d\n", length); 
    164                 gunit_fail_unless (tny_list_get_length (subfolders) == 1, str); 
    165                 g_object_unref (G_OBJECT (iter)); 
    166         } 
    167  
    168         g_object_unref (G_OBJECT (folders)); 
    169         g_object_unref (G_OBJECT (subfolders)); 
    170         g_object_unref (G_OBJECT (query)); 
    171 
    172  
    173  
    174 static void 
    175 tny_folder_store_query_test_match_subscribed (void) 
     163                fail_unless (tny_list_get_length (subfolders) == 1, str); 
     164                g_object_unref (G_OBJECT (iter)); 
     165        } 
     166 
     167        g_object_unref (G_OBJECT (folders)); 
     168        g_object_unref (G_OBJECT (subfolders)); 
     169        g_object_unref (G_OBJECT (query)); 
     170
     171END_TEST 
     172 
     173 
     174START_TEST ( 
     175tny_folder_store_query_test_match_subscribed) 
    176176{ 
    177177        TnyFolderStoreQuery *query = NULL; 
     
    195195     
    196196        str = g_strdup_printf ("Root should have exactly one folder in the test account, it matches %d\n", length); 
    197         gunit_fail_unless (length == 1, str); 
     197        fail_unless (length == 1, str); 
    198198        g_free (str); 
    199199     
     
    208208             
    209209                str = g_strdup_printf ("There's 17 subscribed folders in the test account, I received %d\n", length); 
    210                 gunit_fail_unless (tny_list_get_length (subfolders) == 17, str); 
     210                fail_unless (tny_list_get_length (subfolders) == 17, str); 
    211211                g_free (str); 
    212212                g_object_unref (G_OBJECT (iter)); 
     
    217217        g_object_unref (G_OBJECT (query)); 
    218218}                
    219  
    220  
    221 static void 
    222 tny_folder_store_query_test_match_unsubscribed (void) 
     219END_TEST 
     220 
     221 
     222START_TEST (tny_folder_store_query_test_match_unsubscribed) 
    223223{ 
    224224        TnyFolderStoreQuery *query = NULL; 
     
    242242     
    243243        str = g_strdup_printf ("Root should have exactly one folder in the test account, it matches %d\n", length); 
    244         gunit_fail_unless (length == 1, str); 
     244        fail_unless (length == 1, str); 
    245245        g_free (str); 
    246246     
     
    255255             
    256256                str = g_strdup_printf ("There's 1 subscribed folder in the test account, I received %d\n", length); 
    257                 gunit_fail_unless (tny_list_get_length (subfolders) == 1, str); 
     257                fail_unless (tny_list_get_length (subfolders) == 1, str); 
    258258                g_free (str); 
    259259             
     
    265265        g_object_unref (G_OBJECT (query)); 
    266266} 
    267  
    268  
    269 GUnitTestSuite
     267END_TEST 
     268 
     269Suite
    270270create_tny_folder_store_query_suite (void) 
    271271{ 
    272         GUnitTestSuite *suite = NULL; 
    273      
    274         online_tests = TRUE; 
    275          
    276         /* Create test suite */ 
    277         suite = gunit_test_suite_new ("TnyFolderStoreQuery"); 
    278  
    279         /* Add test case objects to test suite */ 
    280      
    281         gunit_test_suite_add_test_case(suite, 
    282                gunit_test_case_new_with_funcs("tny_folder_store_query_test_match_on_name", 
    283                                       tny_folder_store_query_test_setup, 
    284                                       tny_folder_store_query_test_match_on_name, 
    285                                       tny_folder_store_query_test_teardown)); 
    286  
    287      
    288         gunit_test_suite_add_test_case(suite, 
    289                gunit_test_case_new_with_funcs("tny_folder_store_query_test_match_on_id", 
    290                                       tny_folder_store_query_test_setup, 
    291                                       tny_folder_store_query_test_match_on_id, 
    292                                       tny_folder_store_query_test_teardown)); 
    293  
    294      
    295         gunit_test_suite_add_test_case(suite, 
    296                gunit_test_case_new_with_funcs("tny_folder_store_query_test_match_subscribed", 
    297                                       tny_folder_store_query_test_setup, 
    298                                       tny_folder_store_query_test_match_subscribed, 
    299                                       tny_folder_store_query_test_teardown)); 
    300  
    301         gunit_test_suite_add_test_case(suite, 
    302                gunit_test_case_new_with_funcs("tny_folder_store_query_test_match_unsubscribed", 
    303                                       tny_folder_store_query_test_setup, 
    304                                       tny_folder_store_query_test_match_unsubscribed, 
    305                                       tny_folder_store_query_test_teardown)); 
    306      
    307         online_tests = FALSE; 
    308      
    309         return suite; 
    310 
     272     TCase *tc = NULL; 
     273     Suite *s = suite_create ("Folder Store Query"); 
     274 
     275     tc = tcase_create ("Match Name"); 
     276     tcase_add_checked_fixture (tc, tny_folder_store_query_test_setup, tny_folder_store_query_test_teardown); 
     277     tcase_add_test (tc, tny_folder_store_query_test_match_on_name); 
     278     suite_add_tcase (s, tc); 
     279 
     280     tc = tcase_create ("Match Id"); 
     281     tcase_add_checked_fixture (tc, tny_folder_store_query_test_setup, tny_folder_store_query_test_teardown); 
     282     tcase_add_test (tc, tny_folder_store_query_test_match_on_id); 
     283     suite_add_tcase (s, tc); 
     284 
     285     tc = tcase_create ("Match Subscribed"); 
     286     tcase_add_checked_fixture (tc, tny_folder_store_query_test_setup, tny_folder_store_query_test_teardown); 
     287     tcase_add_test (tc, tny_folder_store_query_test_match_subscribed); 
     288     suite_add_tcase (s, tc); 
     289 
     290     tc = tcase_create ("Match Unsubscribed"); 
     291     tcase_add_checked_fixture (tc, tny_folder_store_query_test_setup, tny_folder_store_query_test_teardown); 
     292     tcase_add_test (tc, tny_folder_store_query_test_match_unsubscribed); 
     293     suite_add_tcase (s, tc); 
     294 
     295     return s; 
     296
  • trunk/libtinymail-test/tny-folder-test.c

    r1266 r1309  
    1 /* tinymail - Tiny Mail gunit test 
     1/* tinymail - Tiny Mail unit test 
    22 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 
    33 * 
     
    1717 */ 
    1818 
    19 #include <string.h> 
    20  
    21 #include <tny-folder-test.h> 
     19#include "check_libtinymail.h" 
     20 
    2221#include <tny-folder.h> 
    2322#include <tny-camel-folder.h> 
     
    118117 
    119118 
    120 static void 
    121 tny_folder_test_get_headers_sync (void) 
     119START_TEST (tny_folder_test_get_headers_sync) 
    122120{ 
    123121        TnyList *headers; 
     
    126124        if (iface == NULL) 
    127125        { 
    128                 GUNIT_WARNING ("Test cannot continue (are you online?)"); 
     126                g_warning ("Test cannot continue (are you online?)"); 
    129127                return; 
    130128        } 
     
    138136         
    139137        str = g_strdup_printf ("I received %d headers, the folder tells me it has %d messages\n", length, all_count); 
    140         gunit_fail_unless (length == all_count, str); 
    141         g_free (str); 
    142      
    143         g_object_unref (G_OBJECT (headers)); 
    144 } 
    145  
    146&n