Changeset 1309
- Timestamp:
- 12/08/06 22:24:38
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/README (modified) (3 diffs)
- trunk/configure.ac (modified) (2 diffs)
- trunk/libtinymail-test/.svnignore (modified) (1 diff)
- trunk/libtinymail-test/Makefile.am (modified) (3 diffs)
- trunk/libtinymail-test/check_libtinymail.h (added)
- trunk/libtinymail-test/check_libtinymail_main.c (added)
- trunk/libtinymail-test/check_libtinymailui.h (added)
- trunk/libtinymail-test/check_libtinymailui_main.c (added)
- trunk/libtinymail-test/tny-account-store-test.c (modified) (3 diffs)
- trunk/libtinymail-test/tny-account-store-test.h (deleted)
- trunk/libtinymail-test/tny-account-test.c (modified) (10 diffs)
- trunk/libtinymail-test/tny-account-test.h (deleted)
- trunk/libtinymail-test/tny-api-test-suite.c (deleted)
- trunk/libtinymail-test/tny-device-test.c (modified) (4 diffs)
- trunk/libtinymail-test/tny-device-test.h (deleted)
- trunk/libtinymail-test/tny-folder-store-query-test.c (modified) (14 diffs)
- trunk/libtinymail-test/tny-folder-store-query-test.h (deleted)
- trunk/libtinymail-test/tny-folder-test.c (modified) (11 diffs)
- trunk/libtinymail-test/tny-folder-test.h (deleted)
- trunk/libtinymail-test/tny-header-test.c (modified) (10 diffs)
- trunk/libtinymail-test/tny-header-test.h (deleted)
- trunk/libtinymail-test/tny-iterator-test.c (deleted)
- trunk/libtinymail-test/tny-iterator-test.h (deleted)
- trunk/libtinymail-test/tny-list-test.c (modified) (14 diffs)
- trunk/libtinymail-test/tny-list-test.h (modified) (2 diffs)
- trunk/libtinymail-test/tny-mime-part-test.c (modified) (11 diffs)
- trunk/libtinymail-test/tny-mime-part-test.h (deleted)
- trunk/libtinymail-test/tny-msg-test.c (modified) (6 diffs)
- trunk/libtinymail-test/tny-msg-test.h (deleted)
- trunk/libtinymail-test/tny-platform-factory-test.c (modified) (4 diffs)
- trunk/libtinymail-test/tny-platform-factory-test.h (deleted)
- trunk/libtinymail-test/tny-simple-api-test-runner.c (deleted)
- trunk/libtinymail-test/tny-simple-test-runner.c (deleted)
- trunk/libtinymail-test/tny-stream-test.c (modified) (7 diffs)
- trunk/libtinymail-test/tny-stream-test.h (deleted)
- trunk/libtinymail-test/tny-test-anything.c (deleted)
- trunk/libtinymail-test/tny-test-object.c (modified) (1 diff)
- trunk/libtinymail-test/tny-test-object.h (modified) (1 diff)
- trunk/libtinymail-test/tny-test-suite.c (modified) (3 diffs)
- trunk/libtinymail-test/tny-test-suite.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r1307 r1309 1 2006-12-08 Øystein Gisnås <oystein@gisnas.net> 2 3 * Ported GUnit unit tests to Check 4 1 5 2006-12-08 Philip Van Hoof <pvanhoof@gnome.org> 2 6 trunk/README
r1298 r1309 25 25 Development tips 26 26 ================ 27 You can find the GUnit framework at https://garage.maemo.org/projects/gunit27 You can find the Check unit test framework at http://check.sourceforge.net/ 28 28 You'll need it if you build with --enable-unit-tests which will compile the 29 29 unit tests. Check the sources of the unit tests for more information. 30 30 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 31 Run all unit tests with 'make check'. 44 32 45 33 Building tips … … 157 145 158 146 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 work147 can find a URL to Check. There's often also Debian packages that will work 160 148 with Ubuntu Dapper & Breezy (and maybe/probably also with newer versions of 161 149 both the Debian and Ubuntu distributions). … … 196 184 197 185 If you want the unit tests, check above at the Development tips section. You 198 can find a URL to GUnitsources.186 can find a URL to Check sources. 199 187 200 188 trunk/configure.ac
r1297 r1309 170 170 AM_CONDITIONAL(BUILD_GNOME, test x$build_gnome = xtrue) 171 171 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}" in177 yes)178 build_apitests=true179 build_unittests=true180 ;;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 186 172 dnl ### Enable building the unit tests ## 187 173 AC_ARG_ENABLE(unit-tests, … … 348 334 dnl ### libtinymail-test, a library for testing purposes ## 349 335 if 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) 337 fi 367 338 368 339 dnl ### tinymail, the demo-ui ## trunk/libtinymail-test/.svnignore
r1256 r1309 2 2 .deps 3 3 Makefile 4 tny-simple-test-runner5 tny-test-anything6 4 .libs 7 tny-simple-api-test-runner 5 check_libtinymail 6 check_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) \ 1 INCLUDES = \ 2 $(CHECK_CFLAGS) \ 3 $(LIBTINYMAIL_CFLAGS) \ 4 $(LIBTINYMAILUI_CFLAGS) \ 5 $(LIBTINYMAILUI_GTK_CFLAGS) \ 4 6 $(LIBTINYMAIL_CAMEL_CFLAGS) \ 5 7 -I$(top_srcdir)/libtinymail \ … … 7 9 -I$(top_srcdir)/libtinymailui-gtk \ 8 10 -I$(top_srcdir)/libtinymail-camel \ 9 -I$(top_srcdir)/libtinymail- gnomevfs\10 -I$(top_srcdir)/ libtinymail-camel/camel-lite11 -I$(top_srcdir)/libtinymail-camel/camel-lite \ 12 -I$(top_srcdir)/tests/shared 11 13 12 if BUILD_GNOME 13 INCLUDES += -DGNOME 14 endif 14 AM_LDFLAGS = \ 15 @CHECK_LIBS@ 15 16 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 = \ 17 LDADD = \ 67 18 $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \ 68 19 $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la \ … … 71 22 $(top_builddir)/tests/shared/libtestsshared.a 72 23 24 # if BUILD_GNOME 25 # INCLUDES += -DGNOME 26 # endif 73 27 74 tny_simple_test_runner_LDFLAGS = $(LIBTINYMAIL_TEST_LIBS) 28 # lib_LTLIBRARIES = \ 29 # libtinymail-test-suite.la \ 30 # libtinymailui-test-suite.la 75 31 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.a82 32 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 90 34 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 98 53 99 # API test suite54 # libtinymail_test_suite_la_CFLAGS = -fPIC 100 55 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 77 TESTS = \ 78 check_libtinymail \ 79 check_libtinymailui 80 81 noinst_PROGRAMS = \ 82 check_libtinymail \ 83 check_libtinymailui 84 85 86 # libtinymail tests 87 88 check_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 \ 103 95 tny-list-test.c \ 104 tny-device-test.c \105 tny-account-test.c \106 96 tny-folder-test.c \ 107 tny-mime-part-test.c \108 tny-test-stream.c \109 tny-header-test.c \110 97 tny-folder-store-query-test.c \ 111 98 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 \ 112 104 tny-platform-factory-test.c \ 113 tny- test-object.c105 tny-stream-test.c 114 106 115 libtinymail_api_test_suite_la_CFLAGS = -fPIC \116 $(LIBTINYMAIL_API_TEST_CFLAGS)117 107 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 121 109 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 110 check_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 test1 /* tinymail - Tiny Mail unit test 2 2 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 3 3 * … … 17 17 */ 18 18 19 #include <string.h>19 #include "check_libtinymail.h" 20 20 21 #include <tny-account-store-test.h>22 21 #include <tny-account-store.h> 23 22 #include <tny-platform-factory.h> … … 53 52 54 53 55 static void 56 tny_account_store_test_something (void) 54 START_TEST (tny_account_store_test_something) 57 55 { 58 56 } 57 END_TEST 59 58 60 GUnitTestSuite*59 Suite * 61 60 create_tny_account_store_suite (void) 62 61 { 63 GUnitTestSuite *suite = NULL;62 Suite *s = suite_create ("Account Store"); 64 63 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); 67 68 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; 78 70 } trunk/libtinymail-test/tny-account-test.c
r1266 r1309 1 /* tinymail - Tiny Mail gunit test1 /* tinymail - Tiny Mail unit test 2 2 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 3 3 * … … 17 17 */ 18 18 19 #include <string.h> 20 21 #include <tny-account-test.h> 19 #include "check_libtinymail.h" 20 22 21 #include <tny-account.h> 23 22 #include <tny-folder-store.h> … … 71 70 tny_account_test_teardown (void) 72 71 { 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)); */ 76 76 77 77 return; 78 78 } 79 79 80 static void 81 tny_store_account_test_get_folders (void) 80 START_TEST (tny_store_account_test_get_folders) 82 81 { 83 82 TnyList *folders = NULL; … … 91 90 folders, NULL, NULL); 92 91 93 gunit_fail_unless (tny_list_get_length (folders) == 1,92 fail_unless (tny_list_get_length (folders) == 1, 94 93 "Account should have at least an inbox folder\n"); 95 94 … … 98 97 return; 99 98 } 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,99 END_TEST 100 101 START_TEST (tny_account_test_get_account_type) 102 { 103 fail_unless (tny_account_get_account_type (iface) == TNY_ACCOUNT_TYPE_STORE, 105 104 "Account type should be store\n"); 106 105 } 107 108 static void 109 tny_account_test_set_hostname (void)106 END_TEST 107 108 START_TEST (tny_account_test_set_hostname) 110 109 { 111 110 const gchar *str_in = "imap.imapserver.com", *str_out; … … 115 114 116 115 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 } 119 END_TEST 120 121 START_TEST (tny_account_test_set_user) 123 122 { 124 123 const gchar *str_in = "myusername", *str_out; … … 128 127 129 128 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 } 132 END_TEST 133 134 START_TEST (tny_account_test_set_id) 136 135 { 137 136 const gchar *str_in = "THE_ID", *str_out; … … 141 140 142 141 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 } 145 END_TEST 146 147 START_TEST (tny_account_test_set_name) 149 148 { 150 149 const gchar *str_in = "The name of the account", *str_out; … … 154 153 155 154 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 } 158 END_TEST 159 160 START_TEST (tny_account_test_set_proto) 162 161 { 163 162 const gchar *str_in = "imap", *str_out; … … 167 166 168 167 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 } 171 END_TEST 172 173 Suite * 174 174 create_tny_account_suite (void) 175 175 { 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 test1 /* tinymail - Tiny Mail unit test 2 2 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 3 3 * … … 17 17 */ 18 18 19 #include <string.h>19 #include "check_libtinymail.h" 20 20 21 #include <tny-device-test.h>22 21 #include <tny-device.h> 23 22 #include <device.h> … … 44 43 /* TODO: test signal connection_changed (hard to test) */ 45 44 46 static void 47 tny_device_test_is_online (void) 45 START_TEST (tny_device_test_is_online) 48 46 { 49 47 tny_device_force_online (iface); 50 48 51 49 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); 53 51 g_free (str); 54 52 … … 56 54 57 55 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); 59 57 g_free (str); 60 58 } 59 END_TEST 61 60 62 GUnitTestSuite*61 Suite * 63 62 create_tny_device_suite (void) 64 63 { 65 GUnitTestSuite *suite = NULL;64 Suite *s = suite_create ("Device"); 66 65 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); 69 70 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; 78 72 } trunk/libtinymail-test/tny-folder-store-query-test.c
r1266 r1309 1 /* tinymail - Tiny Mail gunit test1 /* tinymail - Tiny Mail unit test 2 2 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 3 3 * … … 17 17 */ 18 18 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 23 21 #include <tny-account.h> 24 22 #include <tny-folder-store.h> … … 78 76 } 79 77 80 static void 81 tny_folder_store_query_test_match_on_name (void)78 START_TEST ( 79 tny_folder_store_query_test_match_on_name) 82 80 { 83 81 TnyFolderStoreQuery *query = NULL; … … 101 99 102 100 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); 104 102 g_free (str); 105 103 … … 115 113 116 114 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); 118 116 g_free (str); 119 117 g_object_unref (G_OBJECT (iter)); … … 125 123 126 124 } 127 128 static void 129 tny_folder_store_query_test_match_on_id (void) 125 END_TEST 126 127 START_TEST ( 128 tny_folder_store_query_test_match_on_id) 130 129 { 131 130 TnyFolderStoreQuery *query = NULL; … … 149 148 150 149 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); 152 151 g_free (str); 153 152 … … 162 161 163 162 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 } 171 END_TEST 172 173 174 START_TEST ( 175 tny_folder_store_query_test_match_subscribed) 176 176 { 177 177 TnyFolderStoreQuery *query = NULL; … … 195 195 196 196 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); 198 198 g_free (str); 199 199 … … 208 208 209 209 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); 211 211 g_free (str); 212 212 g_object_unref (G_OBJECT (iter)); … … 217 217 g_object_unref (G_OBJECT (query)); 218 218 } 219 220 221 static void 222 tny_folder_store_query_test_match_unsubscribed (void)219 END_TEST 220 221 222 START_TEST (tny_folder_store_query_test_match_unsubscribed) 223 223 { 224 224 TnyFolderStoreQuery *query = NULL; … … 242 242 243 243 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); 245 245 g_free (str); 246 246 … … 255 255 256 256 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); 258 258 g_free (str); 259 259 … … 265 265 g_object_unref (G_OBJECT (query)); 266 266 } 267 268 269 GUnitTestSuite*267 END_TEST 268 269 Suite * 270 270 create_tny_folder_store_query_suite (void) 271 271 { 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 test1 /* tinymail - Tiny Mail unit test 2 2 * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> 3 3 * … … 17 17 */ 18 18 19 #include <string.h> 20 21 #include <tny-folder-test.h> 19 #include "check_libtinymail.h" 20 22 21 #include <tny-folder.h> 23 22 #include <tny-camel-folder.h> … … 118 117 119 118 120 static void 121 tny_folder_test_get_headers_sync (void) 119 START_TEST (tny_folder_test_get_headers_sync) 122 120 { 123 121 TnyList *headers; … … 126 124 if (iface == NULL) 127 125 { 128 GUNIT_WARNING("Test cannot continue (are you online?)");126 g_warning ("Test cannot continue (are you online?)"); 129 127 return; 130 128 } … … 138 136 139 137 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
