4 * Copyright (C) 2011 Stefan Walter
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 * Author: Stef Walter <stefw@collabora.co.uk>
24 #ifndef EGG_TESTING_H_
25 #define EGG_TESTING_H_
30 #define egg_assert_cmpsize(a, o, b) \
31 g_assert_cmpuint ((guint)(a), o, (guint)(b))
33 #define egg_assert_cmpmem(a, na, cmp, b, nb) \
34 do { gconstpointer __p1 = (a), __p2 = (b); gsize __n1 = (na), __n2 = (nb); \
35 if (__n1 cmp __n2 && memcmp (__p1, __p2, __n1) cmp 0) ; else \
36 egg_assertion_message_cmpmem (G_LOG_DOMAIN, __FILE__, __LINE__, \
37 G_STRFUNC, #a "[" #na"] " #cmp " " #b "[" #nb "]", \
38 __p1, __n1, #cmp, __p2, __n2); } while (0)
40 void egg_assertion_message_cmpmem (const char *domain, const char *file,
41 int line, const char *func,
42 const char *expr, gconstpointer arg1,
43 gsize n_arg1, const char *cmp,
44 gconstpointer arg2, gsize n_arg2);
46 gchar * egg_test_escape_data (const guchar *data,
49 void egg_test_wait_stop (void);
51 #define egg_test_wait() g_assert (egg_test_wait_until (20000) != FALSE)
53 gboolean egg_test_wait_until (int timeout);
55 void egg_test_wait_idle (void);
57 gint egg_tests_run_with_loop (void);
59 #endif /* EGG_DH_H_ */