Added a few simple test framework macros (to be used in YAZ tests).
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 27 Jan 2006 17:30:44 +0000 (17:30 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 27 Jan 2006 17:30:44 +0000 (17:30 +0000)
include/yaz/test.h [new file with mode: 0644]

diff --git a/include/yaz/test.h b/include/yaz/test.h
new file mode 100644 (file)
index 0000000..93ecb06
--- /dev/null
@@ -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 <yaz/yconfig.h>
+#include <stdio.h>
+
+#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
+ */
+