-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestsMacros.h
More file actions
35 lines (27 loc) · 824 Bytes
/
testsMacros.h
File metadata and controls
35 lines (27 loc) · 824 Bytes
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
/**
* Not written by me. I don't know who you are, but thank you.
*/
#ifndef TESTSMACROS_H_
#define TESTSMACROS_H_
#include <stdio.h>
#define TEST_EQUALS(result, a, b) if ((result) && ((a) != (b))) { \
result = false; \
}
#define TEST_DIFFERENT(result, a, b) if ((result) && ((a) == (b))) { \
result = false; \
}
#define TEST_TRUE(result, bool) if ((result) && !(bool)) { \
result = false; \
}
#define TEST_FALSE(result, bool) if ((result) && (bool)) { \
result = false; \
}
#define RUN_TEST(name) printf("Running "); \
printf(#name); \
printf("... "); \
if (!name()) { \
printf("[FAILED]\n"); \
return -1; \
} \
printf("[SUCCESS]\n");
#endif /* TESTSMACROS_H_ */