From: Adam Dickmeiss Date: Fri, 27 Jan 2006 17:30:44 +0000 (+0000) Subject: Added a few simple test framework macros (to be used in YAZ tests). X-Git-Tag: YAZ.2.1.12~21 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=cf75a1bc424083953d4f29e38177f178821de55f;p=yaz-moved-to-github.git Added a few simple test framework macros (to be used in YAZ tests). --- diff --git a/include/yaz/test.h b/include/yaz/test.h new file mode 100644 index 0000000..93ecb06 --- /dev/null +++ b/include/yaz/test.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 1995-2005, Index Data ApS + * See the file LICENSE for details. + * + * $Id: test.h,v 1.1 2006-01-27 17:30:44 adam Exp $ + */ + +#ifndef YAZ_TEST_H +#define YAZ_TEST_H + +#include +#include + +#define YAZ_CHECK_INIT(thename) \ +static char *yaz_unit_test_name = #thename; +static FILE *yaz_unit_file = 0; \ +static int yaz_unit_test_number = 0; \ + +#define YAZ_CHECK(as) \ +yaz_unit_test_number++; \ +if (!yaz_unit_file) yaz_unit_file = stderr; \ +if (!as) { \ + fprintf(yaz_unit_file, "%s:%d test failed: %s\n", __FILE__, __LINE__, #as); \ +} + +#endif +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +