A little more flexible test unit
[yaz-moved-to-github.git] / include / yaz / test.h
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: test.h,v 1.2 2006-01-27 18:58:57 adam Exp $
6  */
7
8 #ifndef YAZ_TEST_H
9 #define YAZ_TEST_H
10
11 #include <yaz/yconfig.h>
12 #include <stdio.h>
13
14 #define YAZ_TEST_TYPE_OK 1
15 #define YAZ_TEST_TYPE_FAIL 2
16
17 #define YAZ_CHECK(as) { \
18   if (as) { \
19     yaz_check_print1(YAZ_TEST_TYPE_OK, __FILE__, __LINE__, #as); \
20   } else { \
21     yaz_check_print1(YAZ_TEST_TYPE_FAIL, __FILE__, __LINE__, #as); \
22   } \
23 }
24
25 #define YAZ_CHECK_INIT(argc, argv) yaz_check_init1(&argc, &argv)
26
27 YAZ_BEGIN_CDECL
28 YAZ_EXPORT void yaz_check_init1(int *argc, char ***argv);
29 YAZ_EXPORT void yaz_check_print1(int type, const char *file, int line,
30                                  const char *expr);
31 YAZ_END_CDECL
32
33
34 #endif
35 /*
36  * Local variables:
37  * c-basic-offset: 4
38  * indent-tabs-mode: nil
39  * End:
40  * vim: shiftwidth=4 tabstop=8 expandtab
41  */
42