aboutsummaryrefslogtreecommitdiff
path: root/test/lib/color.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/color.c')
-rw-r--r--test/lib/color.c52
1 files changed, 52 insertions, 0 deletions
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 <test/lib/color.h>
+
+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;
+}