summaryrefslogtreecommitdiff
path: root/tests/test.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test.h')
-rw-r--r--tests/test.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/test.h b/tests/test.h
index 0beeaab..23bcd48 100644
--- a/tests/test.h
+++ b/tests/test.h
@@ -4,11 +4,12 @@
* Useful definitions and declarations for tests.
*/
-#include <pthread.h>
-
#ifndef _PTHREAD_TEST_H_
#define _PTHREAD_TEST_H_
+#include <pthread.h>
+#include <stdio.h>
+
char * error_string[] = {
"ZERO",
"EPERM",
@@ -55,4 +56,27 @@ char * error_string[] = {
"EILSEQ",
};
+/*
+ * The Mingw32 assert macro calls the CRTDLL _assert function
+ * which pops up a dialog. We want to run in batch mode so
+ * we define our own assert macro.
+ */
+#ifdef NDEBUG
+
+#define assert(e) ((void)0)
+
+#else /* NDEBUG */
+
+#ifdef assert
+# undef assert
+#endif
+
+#define assert(e) \
+ ((e) ? (void) 0 : \
+ (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \
+ #e, __FILE__, (int) __LINE__), exit(1)))
+
+#endif /* NDEBUG */
+
+
#endif