1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*
* gnome-keyring
*
* Copyright (C) 2011 Stefan Walter
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*
* Author: Stef Walter <stefw@collabora.co.uk>
*/
#ifndef EGG_TESTING_H_
#define EGG_TESTING_H_
#include <glib.h>
#include <string.h>
#define egg_assert_cmpsize(a, o, b) \
g_assert_cmpuint ((guint)(a), o, (guint)(b))
#define egg_assert_cmpmem(a, na, cmp, b, nb) \
do { gconstpointer __p1 = (a), __p2 = (b); gsize __n1 = (na), __n2 = (nb); \
if (__n1 cmp __n2 && memcmp (__p1, __p2, __n1) cmp 0) ; else \
egg_assertion_message_cmpmem (G_LOG_DOMAIN, __FILE__, __LINE__, \
G_STRFUNC, #a "[" #na"] " #cmp " " #b "[" #nb "]", \
__p1, __n1, #cmp, __p2, __n2); } while (0)
#define egg_assert_not_object(p) \
(egg_assertion_not_object (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #p, (p)))
void egg_assertion_not_object (const char *domain,
const char *file,
int line,
const char *func,
const char *expr,
gpointer was_object);
void egg_assertion_message_cmpmem (const char *domain, const char *file,
int line, const char *func,
const char *expr, gconstpointer arg1,
gsize n_arg1, const char *cmp,
gconstpointer arg2, gsize n_arg2);
gchar * egg_test_escape_data (const guchar *data,
gsize size);
void egg_test_wait_stop (void);
#define egg_test_wait() g_assert (egg_test_wait_until (20000) != FALSE)
gboolean egg_test_wait_until (int timeout);
void egg_test_wait_idle (void);
gint egg_tests_run_with_loop (void);
#endif /* EGG_DH_H_ */
|