From 9be81ef43c8cfabe72fba16651dbfe62ed0f1123 Mon Sep 17 00:00:00 2001 From: Christian C Date: Fri, 7 Mar 2025 23:48:17 -0800 Subject: Testing suite --- include/test/__meta__.h | 11 ++++++++--- include/test/lib/color.h | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'include/test') 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 #include -#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 #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 -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(); -- cgit v1.2.1