diff options
author | rpj <rpj> | 1999-02-21 18:07:25 +0000 |
---|---|---|
committer | rpj <rpj> | 1999-02-21 18:07:25 +0000 |
commit | 943bc9bb02212649a83ec32152299d50d34226e6 (patch) | |
tree | 55d0329607b7d2fa1044884be957518cc7a52c6e /tests/test.h | |
parent | 1acd28b4aec86a907846e1715bc95208d6e277e6 (diff) |
1999-02-23 Ross Johnson <rpj@ise.canberra.edu.au>
* Makefile: Now actually runs the tests.
* tests.h: Define our own assert macro. The Mingw32
version pops up a dialog but we want to run non-interactively.
* equal1.c: use assert a little more directly so that it
prints the actual call statement.
* exit1.c: Modify to return 0 on success, 1 on failure.
Diffstat (limited to 'tests/test.h')
-rw-r--r-- | tests/test.h | 28 |
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 |