summaryrefslogtreecommitdiff
path: root/source/base/base_test.h
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-04-17 17:49:10 +0200
committernasr <nsrddyn@gmail.com>2026-04-17 17:50:28 +0200
commit078e21a1feb811f9ef7797ce3ee5d2e8ffcccfce (patch)
treec1121bed141fb536be6b21a6fc54ccd2b5ac7302 /source/base/base_test.h
parent9d09d66a273f68fae7efb71504bf40c664b91983 (diff)
feature(main): during my work on other projects I improved the base library a bit.
this is a drag and drop of that in the project. the next steps exit out of implementing lineair regression and attempting to calcualte what the value would be of a key in the btree... Signed-off-by: nasr <nsrddyn@gmail.com> feature(main): during my work on other projects I improved the base library a bit. this is a drag and drop of that in the project. the next steps exit out of implementing lineair regression and attempting to calcualte what the value would be of a key in the btree... Signed-off-by: nasr <nsrddyn@gmail.com>
Diffstat (limited to 'source/base/base_test.h')
-rw-r--r--source/base/base_test.h46
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 */