Add some more testcases with assertions

This commit is contained in:
Ruben Laguna 2015-02-07 18:34:03 +01:00
parent 10c86b7137
commit 0ffb066242

View File

@ -21,10 +21,25 @@ void my_first_test(dfixture *df, gconstpointer ignored) {
g_assert(true); g_assert(true);
} }
void my_second_test(dfixture *df, gconstpointer ignored) {
g_test_fail();
}
void my_third_test(dfixture *df, gconstpointer ignored) {
g_test_incomplete("incomplete means that there is some functionality missing");
}
void my_fourth_test(dfixture *df, gconstpointer ignored) {
g_test_skip("skipped because doesn't apply to GNU/Linux systems");
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
/* https://developer.gnome.org/glib/stable/glib-Testing.html */ /* https://developer.gnome.org/glib/stable/glib-Testing.html */
g_test_init(&argc, &argv, NULL); g_test_init(&argc, &argv, NULL);
g_test_add("/set0/my first test", /* type fixture*/ dfixture, /*tdata*/NULL, /*fsetup*/ my_setup, my_first_test, my_teardown); g_test_add("/set0/my first test", /* type fixture*/ dfixture, /*tdata*/NULL, /*fsetup*/ my_setup, my_first_test, my_teardown);
g_test_add("/set0/my second test", /* type fixture*/ dfixture, /*tdata*/NULL, /*fsetup*/ my_setup, my_second_test, my_teardown);
g_test_add("/set0/my third test", /* type fixture*/ dfixture, /*tdata*/NULL, /*fsetup*/ my_setup, my_third_test, my_teardown);
g_test_add("/set0/my fourth test", /* type fixture*/ dfixture, /*tdata*/NULL, /*fsetup*/ my_setup, my_fourth_test, my_teardown);
return g_test_run(); return g_test_run();
} }