-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathculite.h
More file actions
58 lines (50 loc) · 1.3 KB
/
Copy pathculite.h
File metadata and controls
58 lines (50 loc) · 1.3 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <math.h>
#define ASSERT_DBL_ALMOST_EQUAL(d1, d2, thresh) \
do { \
if (!(fabs(d1 - d2) < thresh)) { \
printf("%f is not almost equal to %f", d1, d2); \
return 1; \
} \
} while (0)
#define ASSERT_TRUE(test, msg) \
do { \
if (!(test)) { \
printf(msg); \
return 1; \
} \
} while (0)
#define ASSERT_INT_EQUAL(i1, i2) \
do { \
if (!(i1 == i2)) { \
printf("%d is not equal to %d", i1, i2); \
return 1; \
} \
} while (0)
#define ASSERT_INT_LT(i1, i2) \
do { \
if (!(i1 < i2)) { \
printf("%d is not less than %d", i1, i2); \
return 1; \
} \
} while (0)
#define ASSERT_INT_GT(i1, i2) \
do { \
if (!(i1 > i2)) { \
printf("%d is not greater than %d", i1, i2); \
return 1; \
} \
} while (0)
#define RUN_TEST(test) \
do { \
printf(#test ": "); \
if (test()) { \
culite_tests_failed++; \
printf(" -> FAILED\n"); \
} else \
printf("PASSED\n"); \
culite_tests_run++; \
} while (0)
#define TEST_CASE(name) int name () {
#define TEST_CASE_END return 0; }
extern int culite_tests_run;
extern int culite_tests_failed;