Debian Codegraph @

pkcs11/gkm/gkm-test.h

raw
1 /*
2 * gnome-keyring
3 *
4 * Copyright (C) 2010 Stefan Walter
5 *
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.
10 *
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.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21 #include <glib.h>
22
23 #include "pkcs11/pkcs11.h"
24 #include "pkcs11/pkcs11i.h"
25
26 #ifndef GKM_TEST_H
27 #define GKM_TEST_H
28
29 #define gkm_assert_cmprv(v1, cmp, v2) \
30 do { CK_RV __v1 = (v1), __v2 = (v2); \
31 if (__v1 cmp __v2) ; else \
32 gkm_assertion_message_cmprv (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
33 #v1 " " #cmp " " #v2, __v1, #cmp, __v2); \
34 } while (0)
35
36 #define gkm_assert_cmpulong(v1, cmp, v2) \
37 do { CK_RV __v1 = (v1), __v2 = (v2); \
38 if (__v1 cmp __v2) ; else \
39 gkm_assertion_message_cmpulong (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
40 #v1 " " #cmp " " #v2, __v1, #cmp, __v2); \
41 } while (0)
42
43 void gkm_assertion_message_cmprv (const gchar *domain,
44 const gchar *file,
45 int line,
46 const gchar *func,
47 const gchar *expr,
48 CK_RV arg1,
49 const gchar *cmp,
50 CK_RV arg2);
51
52 void gkm_assertion_message_cmpulong (const gchar *domain,
53 const gchar *file,
54 gint line,
55 const gchar *func,
56 const gchar *expr,
57 CK_ULONG arg1,
58 const gchar *cmp,
59 CK_ULONG arg2);
60
61 #endif /* GKM_TEST_H */