From afad16ce636dd54fa1fdedd100eb93f1d7b508d6 Mon Sep 17 00:00:00 2001 From: Christian C Date: Fri, 7 Mar 2025 23:05:12 -0800 Subject: Test suite start --- test/lib/color.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/lib/color.c (limited to 'test/lib') diff --git a/test/lib/color.c b/test/lib/color.c new file mode 100644 index 0000000..191972d --- /dev/null +++ b/test/lib/color.c @@ -0,0 +1,52 @@ +#include + +bool_t test_color_zero(uint8_t* color1, size_t channels, bool_t result) +{ + bool_t fcall_result = color_zero(color1, channels); + if (fcall_result == result) { + return TRUE; + } + return FALSE; +} +bool_t test_color_equal(uint8_t* color1, uint8_t* color2, size_t channels, bool_t result) +{ + bool_t fcall_result = color_zero(color1, channels); + if (fcall_result == result) { + return TRUE; + } + return FALSE; +} + +// Meta test function +bool_t TEST_lib_color() +{ + uint8_t test_count = 0; + uint8_t test_pass = 0; + bool_t result; + + // Test 1: 1 channel zero color + // Should result: True + uint8_t test_1_color1[1] = {0}; + result = test_color_zero(test_1_color1, 1, TRUE); + TEST_RESULT(result, test_count, test_pass); + + // Test 2: 1 channel non-zero color + // Should result: False + uint8_t test_2_color1[1] = {1}; + result = test_color_zero(test_2_color1, 1, FALSE); + TEST_RESULT(result, test_count, test_pass); + + // Test 3: 2 channel zero color + // Should result: True + uint8_t test_3_color1[2] = {0,0}; + result = test_color_zero(test_3_color1, 2, TRUE); + TEST_RESULT(result, test_count, test_pass); + + // Test 4: 2 channel non-zero color + // Should result: False + uint8_t test_4_color1[2] = {0,1}; + result = test_color_zero(test_4_color1, 2, FALSE); + TEST_RESULT(result, test_count, test_pass); + + return test_count == test_pass; +} -- cgit v1.2.1