diff options
Diffstat (limited to 'tests/helpers.h')
| -rw-r--r-- | tests/helpers.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/helpers.h b/tests/helpers.h new file mode 100644 index 0000000..f8affe7 --- /dev/null +++ b/tests/helpers.h @@ -0,0 +1,20 @@ +#ifndef DUCC_TESTS_HELPERS_H +#define DUCC_TESTS_HELPERS_H + +void exit(int); +struct FILE; +typedef struct FILE FILE; +int fprintf(FILE*, const char*, ...); +extern FILE* stderr; + +#define ASSERT(a, file, line) \ + do { \ + if (!(a)) { \ + fprintf(stderr, "%s:%d: assert failed", file, line); \ + exit(1); \ + } \ + } while (0) + +#define ASSERT_EQ(a, b) ASSERT((a) == (b), __FILE__, __LINE__) + +#endif |
