From cf75a1bc424083953d4f29e38177f178821de55f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 27 Jan 2006 17:30:44 +0000 Subject: [PATCH] Added a few simple test framework macros (to be used in YAZ tests). --- include/yaz/test.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/yaz/test.h 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 + */ + -- 1.7.10.4