1 /* GLib testing framework examples and tests
2 * Copyright (C) 2007 Imendio AB
5 * This work is provided "as is"; redistribution and modification
6 * in whole or in part, in any medium, physical or electronic is
7 * permitted without restriction.
9 * This work is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * In no event shall the authors or contributors be liable for any
14 * direct, indirect, incidental, special, exemplary, or consequential
15 * damages (including, but not limited to, procurement of substitute
16 * goods or services; loss of use, data, or profits; or business
17 * interruption) however caused and on any theory of liability, whether
18 * in contract, strict liability, or tort (including negligence or
19 * otherwise) arising in any way out of the use of this software, even
20 * if advised of the possibility of such damage.
23 /* We want to distinguish between messages originating from libglib
24 * and messages originating from this program.
27 #define G_LOG_DOMAIN "testing"
34 /* test assertion variants */
36 test_assertions_bad_cmpstr (void)
38 g_assert_cmpstr ("fzz", !=, "fzz");
43 test_assertions_bad_cmpint (void)
45 g_assert_cmpint (4, !=, 4);
50 test_assertions_bad_cmpmem_len (void)
52 g_assert_cmpmem ("foo", 3, "foot", 4);
57 test_assertions_bad_cmpmem_data (void)
59 g_assert_cmpmem ("foo", 3, "fzz", 3);
64 test_assertions_bad_cmpfloat_epsilon (void)
66 g_assert_cmpfloat_with_epsilon (3.14, 3.15, 0.001);
71 test_assertions (void)
74 g_assert_cmpint (1, >, 0);
75 g_assert_cmphex (2, ==, 2);
76 g_assert_cmpfloat (3.3, !=, 7);
77 g_assert_cmpfloat (7, <=, 3 + 4);
78 g_assert_cmpfloat_with_epsilon (3.14, 3.15, 0.01);
79 g_assert_cmpfloat_with_epsilon (3.14159, 3.1416, 0.0001);
81 g_assert_cmpstr ("foo", !=, "faa");
82 fuu
= g_strdup_printf ("f%s", "uu");
83 g_test_queue_free (fuu
);
84 g_assert_cmpstr ("foo", !=, fuu
);
85 g_assert_cmpstr ("fuu", ==, fuu
);
86 g_assert_cmpstr (NULL
, <, "");
87 g_assert_cmpstr (NULL
, ==, NULL
);
88 g_assert_cmpstr ("", >, NULL
);
89 g_assert_cmpstr ("foo", <, "fzz");
90 g_assert_cmpstr ("fzz", >, "faa");
91 g_assert_cmpstr ("fzz", ==, "fzz");
92 g_assert_cmpmem ("foo", 3, "foot", 3);
94 g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstr", 0, 0);
95 g_test_trap_assert_failed ();
96 g_test_trap_assert_stderr ("*assertion failed*");
98 g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpint", 0, 0);
99 g_test_trap_assert_failed ();
100 g_test_trap_assert_stderr ("*assertion failed*");
102 g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_len", 0, 0);
103 g_test_trap_assert_failed ();
104 g_test_trap_assert_stderr ("*assertion failed*len*");
106 g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_data", 0, 0);
107 g_test_trap_assert_failed ();
108 g_test_trap_assert_stderr ("*assertion failed*");
109 g_test_trap_assert_stderr_unmatched ("*assertion failed*len*");
111 g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpfloat_epsilon", 0, 0);
112 g_test_trap_assert_failed ();
113 g_test_trap_assert_stderr ("*assertion failed*");
116 /* test g_test_timer* API */
121 g_test_timer_start();
122 g_assert_cmpfloat (g_test_timer_last(), ==, 0);
123 g_usleep (25 * 1000);
124 ttime
= g_test_timer_elapsed();
125 g_assert_cmpfloat (ttime
, >, 0);
126 g_assert_cmpfloat (g_test_timer_last(), ==, ttime
);
127 g_test_minimized_result (ttime
, "timer-test-time: %fsec", ttime
);
128 g_test_maximized_result (5, "bogus-quantity: %ddummies", 5); /* simple API test */
132 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
134 /* fork out for a failing test */
136 test_fork_fail (void)
138 if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR
))
140 g_assert_not_reached();
142 g_test_trap_assert_failed();
143 g_test_trap_assert_stderr ("*ERROR*test_fork_fail*should not be reached*");
146 /* fork out to assert stdout and stderr patterns */
148 test_fork_patterns (void)
150 if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT
| G_TEST_TRAP_SILENCE_STDERR
))
152 g_print ("some stdout text: somagic17\n");
153 g_printerr ("some stderr text: semagic43\n");
156 g_test_trap_assert_passed();
157 g_test_trap_assert_stdout ("*somagic17*");
158 g_test_trap_assert_stderr ("*semagic43*");
161 /* fork out for a timeout test */
163 test_fork_timeout (void)
165 /* allow child to run for only a fraction of a second */
166 if (g_test_trap_fork (0.11 * 1000000, 0))
168 /* loop and sleep forever */
170 g_usleep (1000 * 1000);
172 g_test_trap_assert_failed();
173 g_assert (g_test_trap_reached_timeout());
176 G_GNUC_END_IGNORE_DEPRECATIONS
177 #endif /* G_OS_UNIX */
180 test_subprocess_fail (void)
182 if (g_test_subprocess ())
184 g_assert_not_reached ();
188 g_test_trap_subprocess (NULL
, 0, 0);
189 g_test_trap_assert_failed ();
190 g_test_trap_assert_stderr ("*ERROR*test_subprocess_fail*should not be reached*");
194 test_subprocess_no_such_test (void)
196 if (g_test_subprocess ())
198 g_test_trap_subprocess ("/trap_subprocess/this-test-does-not-exist", 0, 0);
199 g_assert_not_reached ();
202 g_test_trap_subprocess (NULL
, 0, 0);
203 g_test_trap_assert_failed ();
204 g_test_trap_assert_stderr ("*test does not exist*");
205 g_test_trap_assert_stderr_unmatched ("*should not be reached*");
209 test_subprocess_patterns (void)
211 if (g_test_subprocess ())
213 g_print ("some stdout text: somagic17\n");
214 g_printerr ("some stderr text: semagic43\n");
217 g_test_trap_subprocess (NULL
, 0, 0);
218 g_test_trap_assert_passed ();
219 g_test_trap_assert_stdout ("*somagic17*");
220 g_test_trap_assert_stderr ("*semagic43*");
224 test_subprocess_timeout (void)
226 if (g_test_subprocess ())
228 /* loop and sleep forever */
230 g_usleep (1000 * 1000);
233 /* allow child to run for only a fraction of a second */
234 g_test_trap_subprocess (NULL
, 0.11 * 1000000, 0);
235 g_test_trap_assert_failed ();
236 g_assert (g_test_trap_reached_timeout ());
239 /* run a test with fixture setup and teardown */
246 fixturetest_setup (Fixturetest
*fix
,
247 gconstpointer test_data
)
249 g_assert (test_data
== (void*) 0xc0cac01a);
252 fix
->msg
= g_strdup_printf ("%d", fix
->prime
);
255 fixturetest_test (Fixturetest
*fix
,
256 gconstpointer test_data
)
258 guint prime
= g_spaced_primes_closest (fix
->seed
);
259 g_assert_cmpint (prime
, ==, fix
->prime
);
260 prime
= g_ascii_strtoull (fix
->msg
, NULL
, 0);
261 g_assert_cmpint (prime
, ==, fix
->prime
);
262 g_assert (test_data
== (void*) 0xc0cac01a);
265 fixturetest_teardown (Fixturetest
*fix
,
266 gconstpointer test_data
)
268 g_assert (test_data
== (void*) 0xc0cac01a);
273 int bit
, vint1
, vint2
, irange
;
274 long double vdouble
, drange
;
280 shared_rand_state
.bit
= g_test_rand_bit();
281 shared_rand_state
.vint1
= g_test_rand_int();
282 shared_rand_state
.vint2
= g_test_rand_int();
283 g_assert_cmpint (shared_rand_state
.vint1
, !=, shared_rand_state
.vint2
);
284 shared_rand_state
.irange
= g_test_rand_int_range (17, 35);
285 g_assert_cmpint (shared_rand_state
.irange
, >=, 17);
286 g_assert_cmpint (shared_rand_state
.irange
, <=, 35);
287 shared_rand_state
.vdouble
= g_test_rand_double();
288 shared_rand_state
.drange
= g_test_rand_double_range (-999, +17);
289 g_assert_cmpfloat (shared_rand_state
.drange
, >=, -999);
290 g_assert_cmpfloat (shared_rand_state
.drange
, <=, +17);
296 /* this test only works if run after test1.
297 * we do this to check that random number generators
298 * are reseeded upon fixture setup.
300 g_assert_cmpint (shared_rand_state
.bit
, ==, g_test_rand_bit());
301 g_assert_cmpint (shared_rand_state
.vint1
, ==, g_test_rand_int());
302 g_assert_cmpint (shared_rand_state
.vint2
, ==, g_test_rand_int());
303 g_assert_cmpint (shared_rand_state
.irange
, ==, g_test_rand_int_range (17, 35));
304 g_assert_cmpfloat (shared_rand_state
.vdouble
, ==, g_test_rand_double());
305 g_assert_cmpfloat (shared_rand_state
.drange
, ==, g_test_rand_double_range (-999, +17));
309 test_data_test (gconstpointer test_data
)
311 g_assert (test_data
== (void*) 0xc0c0baba);
315 test_random_conversions (void)
317 /* very simple conversion test using random numbers */
318 int vint
= g_test_rand_int();
319 char *err
, *str
= g_strdup_printf ("%d", vint
);
320 gint64 vint64
= g_ascii_strtoll (str
, &err
, 10);
321 g_assert_cmphex (vint
, ==, vint64
);
322 g_assert (!err
|| *err
== 0);
327 fatal_handler (const gchar
*log_domain
,
328 GLogLevelFlags log_level
,
329 const gchar
*message
,
336 test_fatal_log_handler_critical_pass (void)
338 g_test_log_set_fatal_handler (fatal_handler
, NULL
);
339 g_str_has_prefix (NULL
, "file://");
340 g_critical ("Test passing");
345 test_fatal_log_handler_error_fail (void)
347 g_error ("Test failing");
352 test_fatal_log_handler_critical_fail (void)
354 g_str_has_prefix (NULL
, "file://");
355 g_critical ("Test passing");
360 test_fatal_log_handler (void)
362 g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-pass", 0, 0);
363 g_test_trap_assert_passed ();
364 g_test_trap_assert_stderr ("*CRITICAL*g_str_has_prefix*");
365 g_test_trap_assert_stderr ("*CRITICAL*Test passing*");
367 g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/error-fail", 0, 0);
368 g_test_trap_assert_failed ();
369 g_test_trap_assert_stderr ("*ERROR*Test failing*");
371 g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-fail", 0, 0);
372 g_test_trap_assert_failed ();
373 g_test_trap_assert_stderr ("*CRITICAL*g_str_has_prefix*");
374 g_test_trap_assert_stderr_unmatched ("*CRITICAL*Test passing*");
378 test_expected_messages_warning (void)
380 g_warning ("This is a %d warning", g_random_int ());
381 g_return_if_reached ();
385 test_expected_messages_expect_warning (void)
387 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_WARNING
,
388 "This is a * warning");
389 test_expected_messages_warning ();
393 test_expected_messages_wrong_warning (void)
395 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
397 test_expected_messages_warning ();
401 test_expected_messages_expected (void)
403 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_WARNING
,
404 "This is a * warning");
405 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
406 "*should not be reached");
408 test_expected_messages_warning ();
410 g_test_assert_expected_messages ();
415 test_expected_messages_null_domain (void)
417 g_test_expect_message (NULL
, G_LOG_LEVEL_WARNING
, "no domain");
418 g_log (NULL
, G_LOG_LEVEL_WARNING
, "no domain");
419 g_test_assert_expected_messages ();
423 test_expected_messages_expect_error (void)
425 /* make sure we can't try to expect a g_error() */
426 g_test_expect_message ("GLib", G_LOG_LEVEL_CRITICAL
, "*G_LOG_LEVEL_ERROR*");
427 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_ERROR
, "this won't work");
428 g_test_assert_expected_messages ();
432 test_expected_messages_extra_warning (void)
434 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_WARNING
,
435 "This is a * warning");
436 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
437 "*should not be reached");
438 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
441 test_expected_messages_warning ();
443 /* If we don't assert, it won't notice the missing message */
448 test_expected_messages_unexpected_extra_warning (void)
450 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_WARNING
,
451 "This is a * warning");
452 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
453 "*should not be reached");
454 g_test_expect_message (G_LOG_DOMAIN
, G_LOG_LEVEL_CRITICAL
,
457 test_expected_messages_warning ();
459 g_test_assert_expected_messages ();
464 test_expected_messages (void)
466 g_test_trap_subprocess ("/misc/expected-messages/subprocess/warning", 0, 0);
467 g_test_trap_assert_failed ();
468 g_test_trap_assert_stderr ("*This is a * warning*");
469 g_test_trap_assert_stderr_unmatched ("*should not be reached*");
471 g_test_trap_subprocess ("/misc/expected-messages/subprocess/expect-warning", 0, 0);
472 g_test_trap_assert_failed ();
473 g_test_trap_assert_stderr_unmatched ("*This is a * warning*");
474 g_test_trap_assert_stderr ("*should not be reached*");
476 g_test_trap_subprocess ("/misc/expected-messages/subprocess/wrong-warning", 0, 0);
477 g_test_trap_assert_failed ();
478 g_test_trap_assert_stderr_unmatched ("*should not be reached*");
479 g_test_trap_assert_stderr ("*GLib-CRITICAL*Did not see expected message testing-CRITICAL*should not be *WARNING*This is a * warning*");
481 g_test_trap_subprocess ("/misc/expected-messages/subprocess/expected", 0, 0);
482 g_test_trap_assert_passed ();
483 g_test_trap_assert_stderr ("");
485 g_test_trap_subprocess ("/misc/expected-messages/subprocess/null-domain", 0, 0);
486 g_test_trap_assert_passed ();
487 g_test_trap_assert_stderr ("");
489 g_test_trap_subprocess ("/misc/expected-messages/subprocess/extra-warning", 0, 0);
490 g_test_trap_assert_passed ();
491 g_test_trap_assert_stderr ("");
493 g_test_trap_subprocess ("/misc/expected-messages/subprocess/unexpected-extra-warning", 0, 0);
494 g_test_trap_assert_failed ();
495 g_test_trap_assert_stderr ("*GLib:ERROR*Did not see expected message testing-CRITICAL*nope*");
499 test_expected_messages_debug (void)
501 g_test_expect_message ("Test", G_LOG_LEVEL_WARNING
, "warning message");
502 g_log ("Test", G_LOG_LEVEL_DEBUG
, "should be ignored");
503 g_log ("Test", G_LOG_LEVEL_WARNING
, "warning message");
504 g_test_assert_expected_messages ();
506 g_test_expect_message ("Test", G_LOG_LEVEL_DEBUG
, "debug message");
507 g_log ("Test", G_LOG_LEVEL_DEBUG
, "debug message");
508 g_test_assert_expected_messages ();
512 test_dash_p_hidden (void)
514 if (!g_test_subprocess ())
515 g_assert_not_reached ();
517 g_print ("Test /misc/dash-p/subprocess/hidden ran\n");
521 test_dash_p_hidden_sub (void)
523 if (!g_test_subprocess ())
524 g_assert_not_reached ();
526 g_print ("Test /misc/dash-p/subprocess/hidden/sub ran\n");
529 /* The rest of the dash_p tests will get run by the toplevel test
530 * process, but they shouldn't do anything there.
534 test_dash_p_child (void)
536 if (!g_test_subprocess ())
539 g_print ("Test /misc/dash-p/child ran\n");
543 test_dash_p_child_sub (void)
545 if (!g_test_subprocess ())
548 g_print ("Test /misc/dash-p/child/sub ran\n");
552 test_dash_p_child_sub2 (void)
554 if (!g_test_subprocess ())
557 g_print ("Test /misc/dash-p/child/sub2 ran\n");
561 test_dash_p_child_sub_child (void)
563 if (!g_test_subprocess ())
566 g_print ("Test /misc/dash-p/child/subprocess ran\n");
572 g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden", 0, 0);
573 g_test_trap_assert_passed ();
574 g_test_trap_assert_stdout ("*Test /misc/dash-p/subprocess/hidden ran*");
575 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub ran*");
576 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub2 ran*");
577 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub/subprocess ran*");
578 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child*");
580 g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden/sub", 0, 0);
581 g_test_trap_assert_passed ();
582 g_test_trap_assert_stdout ("*Test /misc/dash-p/subprocess/hidden/sub ran*");
583 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden ran*");
584 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub2 ran*");
585 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/subprocess ran*");
586 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child*");
588 g_test_trap_subprocess ("/misc/dash-p/child", 0, 0);
589 g_test_trap_assert_passed ();
590 g_test_trap_assert_stdout ("*Test /misc/dash-p/child ran*");
591 g_test_trap_assert_stdout ("*Test /misc/dash-p/child/sub ran*");
592 g_test_trap_assert_stdout ("*Test /misc/dash-p/child/sub2 ran*");
593 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child/subprocess ran*");
594 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden*");
596 g_test_trap_subprocess ("/misc/dash-p/child/sub", 0, 0);
597 g_test_trap_assert_passed ();
598 g_test_trap_assert_stdout ("*Test /misc/dash-p/child/sub ran*");
599 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child ran*");
600 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child/sub2 ran*");
601 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child/subprocess ran*");
602 g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden*");
608 if (g_test_subprocess ())
610 g_test_set_nonfatal_assertions ();
611 g_assert_cmpint (4, ==, 5);
612 g_print ("The End\n");
615 g_test_trap_subprocess (NULL
, 0, 0);
616 g_test_trap_assert_failed ();
617 g_test_trap_assert_stderr ("*assertion failed*4 == 5*");
618 g_test_trap_assert_stdout ("*The End*");
624 g_test_skip ("Skipped should count as passed, not failed");
635 if (g_test_subprocess ())
638 g_assert (g_test_failed ());
641 g_test_trap_subprocess (NULL
, 0, 0);
642 g_test_trap_assert_failed ();
646 test_incomplete (void)
648 if (g_test_subprocess ())
650 g_test_incomplete ("not done");
651 g_assert (g_test_failed ());
654 g_test_trap_subprocess (NULL
, 0, 0);
655 g_test_trap_assert_failed ();
659 test_subprocess_timed_out (void)
661 if (g_test_subprocess ())
666 g_test_trap_subprocess (NULL
, 50000, 0);
667 g_assert (g_test_trap_reached_timeout ());
670 static const char *argv0
;
676 GError
*error
= NULL
;
679 argv
= g_ptr_array_new ();
680 g_ptr_array_add (argv
, (char *) argv0
);
681 g_ptr_array_add (argv
, "--GTestSubprocess");
682 g_ptr_array_add (argv
, "-p");
683 g_ptr_array_add (argv
, "/misc/skip");
684 g_ptr_array_add (argv
, NULL
);
686 g_spawn_sync (NULL
, (char **) argv
->pdata
, NULL
,
687 G_SPAWN_STDOUT_TO_DEV_NULL
| G_SPAWN_STDERR_TO_DEV_NULL
,
688 NULL
, NULL
, NULL
, NULL
, &status
,
690 g_assert_no_error (error
);
692 g_spawn_check_exit_status (status
, &error
);
693 g_assert_error (error
, G_SPAWN_EXIT_ERROR
, 77);
694 g_clear_error (&error
);
696 g_ptr_array_set_size (argv
, 0);
697 g_ptr_array_add (argv
, (char *) argv0
);
698 g_ptr_array_add (argv
, "--GTestSubprocess");
699 g_ptr_array_add (argv
, "-p");
700 g_ptr_array_add (argv
, "/misc/skip");
701 g_ptr_array_add (argv
, "-p");
702 g_ptr_array_add (argv
, "/misc/skip-all/subprocess/skip1");
703 g_ptr_array_add (argv
, "-p");
704 g_ptr_array_add (argv
, "/misc/skip-all/subprocess/skip2");
705 g_ptr_array_add (argv
, NULL
);
707 g_spawn_sync (NULL
, (char **) argv
->pdata
, NULL
,
708 G_SPAWN_STDOUT_TO_DEV_NULL
| G_SPAWN_STDERR_TO_DEV_NULL
,
709 NULL
, NULL
, NULL
, NULL
, &status
,
711 g_assert_no_error (error
);
713 g_spawn_check_exit_status (status
, &error
);
714 g_assert_error (error
, G_SPAWN_EXIT_ERROR
, 77);
715 g_clear_error (&error
);
717 g_ptr_array_set_size (argv
, 0);
718 g_ptr_array_add (argv
, (char *) argv0
);
719 g_ptr_array_add (argv
, "--GTestSubprocess");
720 g_ptr_array_add (argv
, "-p");
721 g_ptr_array_add (argv
, "/misc/skip");
722 g_ptr_array_add (argv
, "-p");
723 g_ptr_array_add (argv
, "/misc/skip-all/subprocess/pass");
724 g_ptr_array_add (argv
, "-p");
725 g_ptr_array_add (argv
, "/misc/skip-all/subprocess/skip1");
726 g_ptr_array_add (argv
, NULL
);
728 g_spawn_sync (NULL
, (char **) argv
->pdata
, NULL
,
729 G_SPAWN_STDOUT_TO_DEV_NULL
| G_SPAWN_STDERR_TO_DEV_NULL
,
730 NULL
, NULL
, NULL
, NULL
, &status
,
732 g_assert_no_error (error
);
734 g_spawn_check_exit_status (status
, &error
);
735 g_assert_no_error (error
);
737 g_ptr_array_unref (argv
);
746 g_test_init (&argc
, &argv
, NULL
);
748 g_test_add_func ("/random-generator/rand-1", test_rand1
);
749 g_test_add_func ("/random-generator/rand-2", test_rand2
);
750 g_test_add_func ("/random-generator/random-conversions", test_random_conversions
);
751 g_test_add_func ("/misc/assertions", test_assertions
);
752 g_test_add_func ("/misc/assertions/subprocess/bad_cmpstr", test_assertions_bad_cmpstr
);
753 g_test_add_func ("/misc/assertions/subprocess/bad_cmpint", test_assertions_bad_cmpint
);
754 g_test_add_func ("/misc/assertions/subprocess/bad_cmpmem_len", test_assertions_bad_cmpmem_len
);
755 g_test_add_func ("/misc/assertions/subprocess/bad_cmpmem_data", test_assertions_bad_cmpmem_data
);
756 g_test_add_func ("/misc/assertions/subprocess/bad_cmpfloat_epsilon", test_assertions_bad_cmpfloat_epsilon
);
757 g_test_add_data_func ("/misc/test-data", (void*) 0xc0c0baba, test_data_test
);
758 g_test_add ("/misc/primetoul", Fixturetest
, (void*) 0xc0cac01a, fixturetest_setup
, fixturetest_test
, fixturetest_teardown
);
760 g_test_add_func ("/misc/timer", test_timer
);
763 g_test_add_func ("/forking/fail assertion", test_fork_fail
);
764 g_test_add_func ("/forking/patterns", test_fork_patterns
);
766 g_test_add_func ("/forking/timeout", test_fork_timeout
);
769 g_test_add_func ("/trap_subprocess/fail", test_subprocess_fail
);
770 g_test_add_func ("/trap_subprocess/no-such-test", test_subprocess_no_such_test
);
772 g_test_add_func ("/trap_subprocess/timeout", test_subprocess_timeout
);
774 g_test_add_func ("/trap_subprocess/patterns", test_subprocess_patterns
);
776 g_test_add_func ("/misc/fatal-log-handler", test_fatal_log_handler
);
777 g_test_add_func ("/misc/fatal-log-handler/subprocess/critical-pass", test_fatal_log_handler_critical_pass
);
778 g_test_add_func ("/misc/fatal-log-handler/subprocess/error-fail", test_fatal_log_handler_error_fail
);
779 g_test_add_func ("/misc/fatal-log-handler/subprocess/critical-fail", test_fatal_log_handler_critical_fail
);
781 g_test_add_func ("/misc/expected-messages", test_expected_messages
);
782 g_test_add_func ("/misc/expected-messages/subprocess/warning", test_expected_messages_warning
);
783 g_test_add_func ("/misc/expected-messages/subprocess/expect-warning", test_expected_messages_expect_warning
);
784 g_test_add_func ("/misc/expected-messages/subprocess/wrong-warning", test_expected_messages_wrong_warning
);
785 g_test_add_func ("/misc/expected-messages/subprocess/expected", test_expected_messages_expected
);
786 g_test_add_func ("/misc/expected-messages/subprocess/null-domain", test_expected_messages_null_domain
);
787 g_test_add_func ("/misc/expected-messages/subprocess/extra-warning", test_expected_messages_extra_warning
);
788 g_test_add_func ("/misc/expected-messages/subprocess/unexpected-extra-warning", test_expected_messages_unexpected_extra_warning
);
789 g_test_add_func ("/misc/expected-messages/expect-error", test_expected_messages_expect_error
);
790 g_test_add_func ("/misc/expected-messages/skip-debug", test_expected_messages_debug
);
792 g_test_add_func ("/misc/dash-p", test_dash_p
);
793 g_test_add_func ("/misc/dash-p/child", test_dash_p_child
);
794 g_test_add_func ("/misc/dash-p/child/sub", test_dash_p_child_sub
);
795 g_test_add_func ("/misc/dash-p/child/sub/subprocess", test_dash_p_child_sub_child
);
796 g_test_add_func ("/misc/dash-p/child/sub/subprocess/child", test_dash_p_child_sub_child
);
797 g_test_add_func ("/misc/dash-p/child/sub2", test_dash_p_child_sub2
);
798 g_test_add_func ("/misc/dash-p/subprocess/hidden", test_dash_p_hidden
);
799 g_test_add_func ("/misc/dash-p/subprocess/hidden/sub", test_dash_p_hidden_sub
);
801 g_test_add_func ("/misc/nonfatal", test_nonfatal
);
803 g_test_add_func ("/misc/skip", test_skip
);
804 g_test_add_func ("/misc/skip-all", test_skip_all
);
805 g_test_add_func ("/misc/skip-all/subprocess/skip1", test_skip
);
806 g_test_add_func ("/misc/skip-all/subprocess/skip2", test_skip
);
807 g_test_add_func ("/misc/skip-all/subprocess/pass", test_pass
);
808 g_test_add_func ("/misc/fail", test_fail
);
809 g_test_add_func ("/misc/incomplete", test_incomplete
);
810 g_test_add_func ("/misc/timeout", test_subprocess_timed_out
);