1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2010 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library 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. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
22 #include "test-internal.h"
26 adg_test_init(int *p_argc
, char **p_argv
[])
29 g_test_init(p_argc
, p_argv
, NULL
);
30 g_log_set_always_fatal(0);
31 g_test_bug_base("http://dev.entidi.com/p/adg/issues/%s/");
35 adg_test_invalid_pointer(void)
37 static int junk
[10] = { 0 };
42 _adg_log_handler(const gchar
*log_domain
, GLogLevelFlags log_level
,
43 const gchar
*message
, gpointer user_data
)
48 _adg_test_func(gconstpointer user_data
)
50 void (*test_func
)(void);
51 GLogFunc previous_handler
;
53 test_func
= user_data
;
55 /* Run a test in a forked environment, without showing log messages */
56 previous_handler
= g_log_set_default_handler(_adg_log_handler
, NULL
);
57 if (g_test_trap_fork(0, G_TEST_TRAP_SILENCE_STDERR
)) {
61 g_log_set_default_handler(previous_handler
, NULL
);
63 /* On failed test, rerun it without hiding the log messages */
64 if (!g_test_trap_has_passed())
69 adg_test_add_func(const char *testpath
, void (*test_func
)(void))
71 g_test_add_data_func(testpath
, test_func
, _adg_test_func
);