diff options
Diffstat (limited to 'source/base/base_test.h')
| -rw-r--r-- | source/base/base_test.h | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/source/base/base_test.h b/source/base/base_test.h deleted file mode 100644 index 11028f4..0000000 --- a/source/base/base_test.h +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | #ifndef BASE_TEST_H | ||
| 2 | #define BASE_TEST_H | ||
| 3 | |||
| 4 | void | ||
| 5 | write_int(i32 num); | ||
| 6 | |||
| 7 | #define RED "\x1b[31m" | ||
| 8 | #define GREEN "\x1b[32m" | ||
| 9 | #define RESET "\x1b[0m" | ||
| 10 | #define BLUE "\x1b[34m" | ||
| 11 | |||
| 12 | #define LEN(s) (sizeof(s) - 1) | ||
| 13 | |||
| 14 | #define show \ | ||
| 15 | do \ | ||
| 16 | { \ | ||
| 17 | write(STDOUT_FILENO, __FILE__, sizeof(__FILE__) - 1); \ | ||
| 18 | write(STDOUT_FILENO, ":", 1); \ | ||
| 19 | write(STDOUT_FILENO, __func__, sizeof(__func__) - 1); \ | ||
| 20 | write(STDOUT_FILENO, ":", 1); \ | ||
| 21 | write_int(__LINE__); \ | ||
| 22 | write(STDOUT_FILENO, "\n", 1); \ | ||
| 23 | } while (0) | ||
| 24 | |||
| 25 | #define test(expr) \ | ||
| 26 | { \ | ||
| 27 | if ((expr) != 0) \ | ||
| 28 | { \ | ||
| 29 | write(STDERR_FILENO, "[FAILED] ", LEN("[FAILED] ")); \ | ||
| 30 | show; \ | ||
| 31 | _exit(1); \ | ||
| 32 | } \ | ||
| 33 | } | ||
| 34 | |||
| 35 | #define check(expr) \ | ||
| 36 | { \ | ||
| 37 | if ((expr) != 0) \ | ||
| 38 | { \ | ||
| 39 | write(STDERR_FILENO, RED "[ERROR] ", LEN(RED "[ERROR] ")); \ | ||
| 40 | show; \ | ||
| 41 | write(STDERR_FILENO, RESET, LEN(RESET)); \ | ||
| 42 | _exit(1); \ | ||
| 43 | } \ | ||
| 44 | else \ | ||
| 45 | { \ | ||
| 46 | write(STDERR_FILENO, GREEN "[SUCCESS] ", LEN(GREEN "[SUCCESS] ")); \ | ||
| 47 | show; \ | ||
| 48 | write(STDERR_FILENO, RESET, LEN(RESET)); \ | ||
| 49 | } \ | ||
| 50 | } | ||
| 51 | |||
| 52 | #define checkpoint_output "<<CHECKPOINT>>\n" | ||
| 53 | #define checkpoint_end_output "^^^^^^^^^^^^^^\n\n\n" | ||
| 54 | #define checkpoint \ | ||
| 55 | { \ | ||
| 56 | write(STDERR_FILENO, BLUE checkpoint_output, LEN(BLUE checkpoint_output)); \ | ||
| 57 | show; \ | ||
| 58 | write(STDERR_FILENO, BLUE checkpoint_end_output, LEN(BLUE checkpoint_end_output)); \ | ||
| 59 | } | ||
| 60 | |||
| 61 | #endif /* BASE_TEST_H */ | ||
