blob: e8faf541300b257ffbb5023010ce0bc6482b1b10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifndef LILY_TEST_H
#define LILY_TEST_H
#define lily_test const char *
struct lily_test_data_t {
int tests_run;
int tests_failed;
};
#define LILY_INIT() \
struct lily_test_data_t lily_test_data = { 0, 0 };
// helper macros to turn numerical constants into strings
#define STR_IMPL(x) #x
#define STR(X) STR_IMPL(x)
// assertion macros
#define lily_indent " "
#define lily_assert(statement, message) \
do { \
if (!(statement)) \
return "" message \
"\n" lily_indent " [" __FILE__ ":" STR(__LINE__) "]"; \
} while(0)
#define lily_assert_equal(a, b) lily_assert((a) == (b), "'" #a "' is not equal to '" #b "'")
#endif
|