From 53cd9c4c3408b5f2e54e891baf471c0d774ea2cd Mon Sep 17 00:00:00 2001 From: nasr Date: Sat, 14 Mar 2026 21:40:32 +0000 Subject: feature(base): ascii colors, error framework ( ai help ). testing idea meta program. refactor --- source/base/base_test.h | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'source/base/base_test.h') diff --git a/source/base/base_test.h b/source/base/base_test.h index 7619cfb..fd47abc 100644 --- a/source/base/base_test.h +++ b/source/base/base_test.h @@ -1,29 +1,10 @@ +// TODO(nasr): metaprogram that takes an expected output and generates a test for that specified +// function +/* base library testing framework */ #ifndef BASE_TEST_H #define BASE_TEST_H -#define RED "\x1b[31m" -#define GREEN "\x1b[32m" -#define RESET "\x1b[0m" -#define BLUE "\x1b[34m" - -#define LEN(s) (sizeof(s) - 1) - -internal void -write_int(s32 num) -{ - - if (num < 0) - { - write(STDERR_FILENO, "-", 1); - num = -num; - } - if (num >= 10) - write_int(num / 10); - char digit = '0' + (num % 10); - - write(STDERR_FILENO, &digit, 1); -} - +// helper macro #define show \ do \ { \ @@ -45,7 +26,7 @@ write_int(s32 num) } \ } -#define check(expr) \ +#define verify(expr) \ { \ if ((expr) != 0) \ { \ @@ -62,13 +43,4 @@ write_int(s32 num) } \ } -#define checkpoint_output "<>\n" -#define checkpoint_end_output "^^^^^^^^^^^^^^\n\n\n" -#define checkpoint \ - { \ - write(STDERR_FILENO, BLUE checkpoint_output, LEN(BLUE checkpoint_output)); \ - show; \ - write(STDERR_FILENO, BLUE checkpoint_end_output, LEN(BLUE checkpoint_end_output)); \ - } - #endif /* BASE_TEST_H */ -- cgit v1.3