aboutsummaryrefslogtreecommitdiff
path: root/include/test
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2025-03-07 23:48:17 -0800
committerChristian C <cc@localhost>2025-03-07 23:48:17 -0800
commit9be81ef43c8cfabe72fba16651dbfe62ed0f1123 (patch)
treee767747b5fd49b3bb2c2693328844b5ea0368b52 /include/test
parentafad16ce636dd54fa1fdedd100eb93f1d7b508d6 (diff)
Testing suite
Diffstat (limited to 'include/test')
-rw-r--r--include/test/__meta__.h11
-rw-r--r--include/test/lib/color.h6
2 files changed, 11 insertions, 6 deletions
diff --git a/include/test/__meta__.h b/include/test/__meta__.h
index 05a202f..b4cc360 100644
--- a/include/test/__meta__.h
+++ b/include/test/__meta__.h
@@ -4,11 +4,16 @@
#include <lib/bool.h>
#include <stdio.h>
-#define _TEST_PASS(s,n) fprintf(stderr, "%s/%02X: \x1b[92mPASS\x1b[0m\n", s, ++n)
-#define _TEST_FAIL(s,n) fprintf(stderr, "%s/%02X: \x1b[91mFAIL\x1b[0m\n", s, ++n)
+#ifdef TEST_SHOW_PASS
+#define _TEST_PASS(s,sub,n) fprintf(stderr, "%s/%s/%02X: \x1b[92mPASS\x1b[0m\n", s, sub, ++n)
+#else
+#define _TEST_PASS(s,sub,n) ++n
+#endif
+
+#define _TEST_FAIL(s,sub,n) fprintf(stderr, "%s%s/%02X: \x1b[91mFAIL\x1b[0m\n", s, sub, ++n)
#ifndef _TEST_RESULT
-#define _TEST_RESULT(docstring,result,n,n_success) if (!result) {_TEST_FAIL(docstring, n);} else {_TEST_PASS(docstring,n);n_success++;}
+#define _TEST_RESULT(main_string,subtest_string,result,n,n_success) if (!result) {_TEST_FAIL(main_string,subtest_string, n);} else {_TEST_PASS(main_string,subtest_string,n);n_success++;}
#endif
#endif
diff --git a/include/test/lib/color.h b/include/test/lib/color.h
index 835cb0a..be0d62f 100644
--- a/include/test/lib/color.h
+++ b/include/test/lib/color.h
@@ -3,13 +3,13 @@
#include <test/__meta__.h>
#ifndef TEST_RESULT
-#define TEST_RESULT(result,n,n_success) _TEST_RESULT("LIB/COLOR",result,n,n_success)
+#define TEST_RESULT(subtest,result,n,n_success) _TEST_RESULT("LIB/COLOR",subtest,result,n,n_success)
#endif
#include <lib/color.h>
-bool_t test_color_zero(uint8_t* color1, size_t channels, bool_t result);
-bool_t test_color_equal(uint8_t* color1, uint8_t* color2, size_t channels, bool_t result);
+bool_t test_color_zero(const uint8_t* color1, size_t channels, bool_t result);
+bool_t test_color_equal(const uint8_t* color1, const uint8_t* color2, size_t channels, bool_t result);
// Meta test function
bool_t TEST_lib_color();