2 * Copyright (C) 1995-2006, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: test.h,v 1.5 2006-04-20 20:50:51 adam Exp $
9 \brief Unit Test for YAZ
15 #include <yaz/yconfig.h>
19 #define YAZ_TEST_TYPE_OK 1
20 /** \brief Test failed */
21 #define YAZ_TEST_TYPE_FAIL 2
23 /** \brief boolean test. as only evaluated once */
24 #define YAZ_CHECK(as) { \
26 yaz_check_print1(YAZ_TEST_TYPE_OK, __FILE__, __LINE__, #as); \
28 yaz_check_print1(YAZ_TEST_TYPE_FAIL, __FILE__, __LINE__, #as); \
32 /** \brief equality test. left, right only evaluated once */
33 #define YAZ_CHECK_EQ(left, right) { \
37 yaz_check_eq1(YAZ_TEST_TYPE_OK, __FILE__, __LINE__, \
38 #left, #right, lval, rval); \
40 yaz_check_eq1(YAZ_TEST_TYPE_FAIL, __FILE__, __LINE__, \
41 #left, #right, lval, rval); \
45 /** \brief Macro to initialize the system (in start of main typically) */
46 #define YAZ_CHECK_INIT(argc, argv) yaz_check_init1(&argc, &argv)
47 /** \brief Macro to terminate the system (end of main, normally) */
48 #define YAZ_CHECK_TERM yaz_check_term1(); return 0
51 /** \brief used by macro. Should not be called directly */
52 YAZ_EXPORT void yaz_check_init1(int *argc, char ***argv);
53 /** \brief used by macro. Should not be called directly */
54 YAZ_EXPORT void yaz_check_term1(void);
55 /** \brief used by macro. Should not be called directly */
56 YAZ_EXPORT void yaz_check_print1(int type, const char *file, int line,
58 /** \brief used by macro. Should not be called directly */
59 YAZ_EXPORT void yaz_check_eq1(int type, const char *file, int line,
60 const char *left, const char *right,
68 * indent-tabs-mode: nil
70 * vim: shiftwidth=4 tabstop=8 expandtab