tests: move common test code in libadgtest
[adg.git] / src / tests / adg-test.h
blobf121e2ef70bb47bea4b7aaaaae0dd7f94f8005d2
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007-2015 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.
21 #ifndef __ADG_TEST_H__
22 #define __ADG_TEST_H__
24 #include <glib-object.h>
27 G_BEGIN_DECLS
29 /* Redefine the g_assert_cmpfloat() macro by using "float" instead of
30 * "long double" helper variables. This is needed by FreeBSD to pass
31 * the tests: g_value_get_double() seems to suffer a precision loss on
32 * this OS that invalidates the comparation between doubles.
34 #undef g_assert_cmpfloat
35 #define g_assert_cmpfloat(n1,cmp,n2) \
36 do { \
37 float __n1 = (n1), __n2 = (n2); \
38 if (__n1 cmp __n2) \
39 ; \
40 else \
41 g_assertion_message_cmpnum(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
42 #n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'f'); \
43 } while (0)
46 void adg_test_init (int *p_argc,
47 char **p_argv[]);
48 const gpointer adg_test_invalid_pointer (void);
49 void adg_test_add_func (const gchar *testpath,
50 GCallback test_func);
52 G_END_DECLS
55 #endif /* __ADG_TEST_H__ */