aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-09-13 12:06:49 -0400
committernodist <kevin.comas.git@gmail.com>2026-09-13 12:06:49 -0400
commit33d09be340ec13cd02735dbcfe4fc810c4ad5902 (patch)
treee932153595e76d4f21ac201bc2a0a690e318b2c0 /test
parenta82f63b4128f2cac400ae5163011c3df715f6311 (diff)
set up make
Diffstat (limited to 'test')
-rw-r--r--test/README58
-rw-r--r--test/test.c6
2 files changed, 64 insertions, 0 deletions
diff --git a/test/README b/test/README
new file mode 100644
index 0000000..80d57e6
--- /dev/null
+++ b/test/README
@@ -0,0 +1,58 @@
+Testing
+
+---
+
+File Layout:
+
+The test files mirror the src files, so a function in src/file.c would have a test in test/file.c
+
+---
+
+Includes:
+
+#include "kpl_test.h"
+
+This is the only include a .c file in the test folder needs
+
+---
+
+Writing Tests:
+
+TEST(test_name) {
+ // TEST CODE
+}
+
+Tests pass by default
+
+---
+
+Asserting:
+
+ASSERT(CONDITION, FAIL_MESSAGE);
+
+---
+
+Failing:
+
+FAIL(FAIL_MESSAGE);
+
+---
+
+Building:
+
+make kpl_test # build test exec
+make kpl_test_error # build test exec with address, leak and undefined sanitizer
+make kpl_test_thread # build test exec with thread sanitizer
+
+All objects need to be built with the same sanitizer and do not run valgrind when sanitizers are added
+
+---
+
+Running:
+
+./kpl_test [OPTIONS] # Run all tests
+./kpl_test [OPTIONS] NAME # Run test named NAME
+./kpl_test [OPTIONS] NAME1 NAME2 ... # Run selected tests named NAM1 NAME2 ...
+./kpl_test -h # Show OPTIONS
+
+---
diff --git a/test/test.c b/test/test.c
new file mode 100644
index 0000000..f12ee6e
--- /dev/null
+++ b/test/test.c
@@ -0,0 +1,6 @@
+
+#include "kpl_test.h"
+
+int main(void) {
+ return 2;
+}