2 * Copyright (C) 1995-2006, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: test.h,v 1.6 2006-05-10 12:52:17 heikki Exp $
9 \brief Unit Test for YAZ
15 #include <yaz/yconfig.h>
18 /** \brief Get the verbosity level */
19 int yaz_test_get_verbosity();
22 #define YAZ_TEST_TYPE_OK 1
23 /** \brief Test failed */
24 #define YAZ_TEST_TYPE_FAIL 2
26 /** \brief boolean test. as only evaluated once */
27 #define YAZ_CHECK(as) { \
29 yaz_check_print1(YAZ_TEST_TYPE_OK, __FILE__, __LINE__, #as); \
31 yaz_check_print1(YAZ_TEST_TYPE_FAIL, __FILE__, __LINE__, #as); \
35 /** \brief equality test. left, right only evaluated once */
36 #define YAZ_CHECK_EQ(left, right) { \
40 yaz_check_eq1(YAZ_TEST_TYPE_OK, __FILE__, __LINE__, \
41 #left, #right, lval, rval); \
43 yaz_check_eq1(YAZ_TEST_TYPE_FAIL, __FILE__, __LINE__, \
44 #left, #right, lval, rval); \
48 /** \brief Macro to initialize the system (in start of main typically) */
49 #define YAZ_CHECK_INIT(argc, argv) yaz_check_init1(&argc, &argv)
50 /** \brief Macro to terminate the system (end of main, normally) */
51 #define YAZ_CHECK_TERM yaz_check_term1(); return 0
55 /** \brief used by macro. Should not be called directly */
56 YAZ_EXPORT void yaz_check_init1(int *argc, char ***argv);
57 /** \brief used by macro. Should not be called directly */
58 YAZ_EXPORT void yaz_check_term1(void);
59 /** \brief used by macro. Should not be called directly */
60 YAZ_EXPORT void yaz_check_print1(int type, const char *file, int line,
62 /** \brief used by macro. Should not be called directly */
63 YAZ_EXPORT void yaz_check_eq1(int type, const char *file, int line,
64 const char *left, const char *right,
72 * indent-tabs-mode: nil
74 * vim: shiftwidth=4 tabstop=8 expandtab