diff options
author | Dan Winship <danw@gnome.org> | 2013-02-24 12:56:53 +0100 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-02-26 13:07:33 +0100 |
commit | f936400c388b0664961bb8bba9d02efdce8d7630 (patch) | |
tree | 4b7f512c634e4142baae1553abe7ec38da001b64 /callouts | |
parent | ed9e2d8377ed308a141aac982bd5b417d1ccdc1b (diff) | |
download | NetworkManager-f936400c388b0664961bb8bba9d02efdce8d7630.tar.gz |
tests: clean up gtester usage
Use g_test_add_func() and g_test_add_data_func() to simplify the test
cases, getting rid of the GLIB_CHECK_VERSION calls in the process.
Diffstat (limited to 'callouts')
-rw-r--r-- | callouts/tests/test-dispatcher-envp.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index 677376907b..a93882f470 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -630,31 +630,20 @@ test_up_empty_vpn_iface (const char *path) /*******************************************/ -#if GLIB_CHECK_VERSION(2,25,12) -typedef GTestFixtureFunc TCFunc; -#else -typedef void (*TCFunc)(void); -#endif - -#define TESTCASE(t, d) g_test_create_case (#t, 0, d, NULL, (TCFunc) t, NULL) - -int main (int argc, char **argv) +int +main (int argc, char **argv) { - GTestSuite *suite; - g_assert (argc > 1); g_test_init (&argc, &argv, NULL); g_type_init (); - suite = g_test_get_root (); - - g_test_suite_add (suite, TESTCASE (test_old_up, argv[1])); - g_test_suite_add (suite, TESTCASE (test_old_down, argv[1])); - g_test_suite_add (suite, TESTCASE (test_old_vpn_up, argv[1])); - g_test_suite_add (suite, TESTCASE (test_old_vpn_down, argv[1])); + g_test_add_data_func ("/dispatcher/old_up", argv[1], (GTestDataFunc) test_old_up); + g_test_add_data_func ("/dispatcher/old_down", argv[1], (GTestDataFunc) test_old_down); + g_test_add_data_func ("/dispatcher/old_vpn_up", argv[1], (GTestDataFunc) test_old_vpn_up); + g_test_add_data_func ("/dispatcher/old_vpn_down", argv[1], (GTestDataFunc) test_old_vpn_down); - g_test_suite_add (suite, TESTCASE (test_up_empty_vpn_iface, argv[1])); + g_test_add_data_func ("/dispatcher/up_empty_vpn_iface", argv[1], (GTestDataFunc) test_up_empty_vpn_iface); return g_test_run (); } |