diff options
Diffstat (limited to 'source/base/base_test.h')
| -rw-r--r-- | source/base/base_test.h | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/source/base/base_test.h b/source/base/base_test.h deleted file mode 100644 index fd47abc..0000000 --- a/source/base/base_test.h +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | // TODO(nasr): metaprogram that takes an expected output and generates a test for that specified | ||
| 2 | // function | ||
| 3 | /* base library testing framework */ | ||
| 4 | #ifndef BASE_TEST_H | ||
| 5 | #define BASE_TEST_H | ||
| 6 | |||
| 7 | // helper macro | ||
| 8 | #define show \ | ||
| 9 | do \ | ||
| 10 | { \ | ||
| 11 | write(STDOUT_FILENO, __FILE__, sizeof(__FILE__) - 1); \ | ||
| 12 | write(STDOUT_FILENO, ":", 1); \ | ||
| 13 | write(STDOUT_FILENO, __func__, sizeof(__func__) - 1); \ | ||
| 14 | write(STDOUT_FILENO, ":", 1); \ | ||
| 15 | write_int(__LINE__); \ | ||
| 16 | write(STDOUT_FILENO, "\n", 1); \ | ||
| 17 | } while (0) | ||
| 18 | |||
| 19 | #define test(expr) \ | ||
| 20 | { \ | ||
| 21 | if ((expr) != 0) \ | ||
| 22 | { \ | ||
| 23 | write(STDERR_FILENO, "[FAILED] ", LEN("[FAILED] ")); \ | ||
| 24 | show; \ | ||
| 25 | _exit(1); \ | ||
| 26 | } \ | ||
| 27 | } | ||
| 28 | |||
| 29 | #define verify(expr) \ | ||
| 30 | { \ | ||
| 31 | if ((expr) != 0) \ | ||
| 32 | { \ | ||
| 33 | write(STDERR_FILENO, RED "[ERROR] ", LEN(RED "[ERROR] ")); \ | ||
| 34 | show; \ | ||
| 35 | write(STDERR_FILENO, RESET, LEN(RESET)); \ | ||
| 36 | _exit(1); \ | ||
| 37 | } \ | ||
| 38 | else \ | ||
| 39 | { \ | ||
| 40 | write(STDERR_FILENO, GREEN "[SUCCESS] ", LEN(GREEN "[SUCCESS] ")); \ | ||
| 41 | show; \ | ||
| 42 | write(STDERR_FILENO, RESET, LEN(RESET)); \ | ||
| 43 | } \ | ||
| 44 | } | ||
| 45 | |||
| 46 | #endif /* BASE_TEST_H */ | ||
