X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fyaz%2Ftest.h;h=a9f55740db13ced4399ff503d1fb6f20945278d3;hb=be6bf53019f49c1448f0161e3b0ce8d3b5b09ec0;hp=c57b1975982b8645e1c4d0f5d6a2837980132edd;hpb=821e247a6d064e29703c74b21f755baaf4cc1e6e;p=yaz-moved-to-github.git diff --git a/include/yaz/test.h b/include/yaz/test.h index c57b197..a9f5574 100644 --- a/include/yaz/test.h +++ b/include/yaz/test.h @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: test.h,v 1.6 2006-05-10 12:52:17 heikki Exp $ + * $Id: test.h,v 1.10 2006-10-04 16:59:33 mike Exp $ */ /** \file test.h @@ -16,7 +16,7 @@ #include /** \brief Get the verbosity level */ -int yaz_test_get_verbosity(); +int yaz_test_get_verbosity(void); /** \brief Test OK */ #define YAZ_TEST_TYPE_OK 1 @@ -32,6 +32,22 @@ int yaz_test_get_verbosity(); } \ } +/** \brief a test we know will fail at this time. + * + * Later, when the bug is fixed, this test will suddenly pass, + * which will be reported as an error, to remind you to go and fix + * your tests. + */ + +#define YAZ_CHECK_TODO(as) { \ + yaz_check_inc_todo(); \ + if (!as) { \ + yaz_check_print1(YAZ_TEST_TYPE_OK, __FILE__, __LINE__, "TODO: " #as); \ + } else { \ + yaz_check_print1(YAZ_TEST_TYPE_FAIL, __FILE__, __LINE__, "TODO: "#as); \ + } \ +} + /** \brief equality test. left, right only evaluated once */ #define YAZ_CHECK_EQ(left, right) { \ int lval = left; \ @@ -50,12 +66,20 @@ int yaz_test_get_verbosity(); /** \brief Macro to terminate the system (end of main, normally) */ #define YAZ_CHECK_TERM yaz_check_term1(); return 0 +/** \brief Macro to enable and initialize the yaz_log(start of main) */ +#define YAZ_CHECK_LOG() yaz_check_init_log(argv[0]) YAZ_BEGIN_CDECL + /** \brief used by macro. Should not be called directly */ YAZ_EXPORT void yaz_check_init1(int *argc, char ***argv); + /** \brief used by macro. Should not be called directly */ YAZ_EXPORT void yaz_check_term1(void); + +/** \brief used by macro. Should not be called directly */ +YAZ_EXPORT void yaz_check_init_log(const char *argv0); + /** \brief used by macro. Should not be called directly */ YAZ_EXPORT void yaz_check_print1(int type, const char *file, int line, const char *expr); @@ -63,6 +87,8 @@ YAZ_EXPORT void yaz_check_print1(int type, const char *file, int line, YAZ_EXPORT void yaz_check_eq1(int type, const char *file, int line, const char *left, const char *right, int lval, int rval); +/** \brief used by macro. Should not be called directly */ +YAZ_EXPORT void yaz_check_inc_todo(void); YAZ_END_CDECL #endif