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.c73
1 files changed, 36 insertions, 37 deletions
diff --git a/test/lib/color.c b/test/lib/color.c
index e791d95..a93d47d 100644
--- a/test/lib/color.c
+++ b/test/lib/color.c
@@ -1,13 +1,13 @@
#include <test/lib/color.h>
-const ImageData_t test_rgba[4] = {0,0,0,0};
-const ImageData_t test_Rgba[4] = {1,0,0,0};
-const ImageData_t test_rGba[4] = {0,1,0,0};
-const ImageData_t test_rgBa[4] = {0,0,1,0};
-const ImageData_t test_rgbA[4] = {0,0,0,1};
-
-bool_t test_color_zero(const ImageData_t* color1, size_t channels, bool_t result)
-{
+const ImageData_t test_rgba[4] = {0, 0, 0, 0};
+const ImageData_t test_Rgba[4] = {1, 0, 0, 0};
+const ImageData_t test_rGba[4] = {0, 1, 0, 0};
+const ImageData_t test_rgBa[4] = {0, 0, 1, 0};
+const ImageData_t test_rgbA[4] = {0, 0, 0, 1};
+
+bool_t test_color_zero(const ImageData_t *color1, size_t channels,
+ bool_t result) {
bool_t fcall_result = color_zero(color1, channels);
if (fcall_result == result) {
return TRUE;
@@ -15,66 +15,66 @@ bool_t test_color_zero(const ImageData_t* color1, size_t channels, bool_t result
return FALSE;
}
-void _TEST_color_zero(bool_t* result, TestCount_t* test_count, TestCount_t* test_pass)
-{
+void _TEST_color_zero(bool_t *result, TestCount_t *test_count,
+ TestCount_t *test_pass) {
bool_t sub_result;
// Test 1: 1 channel zero color
// Should result: True
sub_result = test_color_zero(test_rgba, 1, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 2: 1 channel non-zero color
// Should result: False
sub_result = test_color_zero(test_Rgba, 1, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 3: 2 channel zero color
// Should result: True
sub_result = test_color_zero(test_rgba, 2, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 4: 2 channel non-zero color
// Should result: False
sub_result = test_color_zero(test_rGba, 2, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 5: 3 channel zero color
// Should result: True
sub_result = test_color_zero(test_rgba, 3, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 6: 3 channel non-zero color
// Should result: False
sub_result = test_color_zero(test_rgBa, 3, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 7: 4 channel zero color
// Should result: True
sub_result = test_color_zero(test_rgba, 4, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 8: 4 channel non-zero color
// Should result: False
sub_result = test_color_zero(test_rgBa, 4, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
// Test 9: 4 channel non-zero color (Alpha non-zero)
// Should result: True
sub_result = test_color_zero(test_rgbA, 4, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_ZERO",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_ZERO", sub_result, *test_count, (*test_pass));
}
-bool_t test_color_equal(const ImageData_t* color1, const ImageData_t* color2, size_t channels, bool_t result)
-{
+bool_t test_color_equal(const ImageData_t *color1, const ImageData_t *color2,
+ size_t channels, bool_t result) {
bool_t fcall_result = color_equal(color1, color2, channels);
if (fcall_result == result) {
return TRUE;
@@ -82,85 +82,84 @@ bool_t test_color_equal(const ImageData_t* color1, const ImageData_t* color2, si
return FALSE;
}
-void _TEST_color_equal(bool_t* result, TestCount_t* test_count, TestCount_t* test_pass)
-{
+void _TEST_color_equal(bool_t *result, TestCount_t *test_count,
+ TestCount_t *test_pass) {
bool_t sub_result;
// Test 1: 1 channel equal (zero)
// Should result: True
sub_result = test_color_equal(test_rgba, test_rgba, 1, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 2: 1 channel equal (nonzero)
// Should result: True
sub_result = test_color_equal(test_Rgba, test_Rgba, 1, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 3: 1 channel nonequal
// Should result: True
sub_result = test_color_equal(test_rgba, test_Rgba, 1, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 4: 2 channel equal (zero)
// Should result: True
sub_result = test_color_equal(test_rgba, test_rgba, 2, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 5: 2 channel equal (nonzero)
// Should result: True
sub_result = test_color_equal(test_rGba, test_rGba, 2, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 6: 2 channel nonequal
// Should result: False
sub_result = test_color_equal(test_Rgba, test_rGba, 2, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 7: 3 channel equal (zero)
// Should result: True
sub_result = test_color_equal(test_rgba, test_rgba, 3, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 8: 3 channel equal (nonzero)
// Should result: True
sub_result = test_color_equal(test_rgBa, test_rgBa, 3, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 9: 3 channel nonequal
// Should result: False
sub_result = test_color_equal(test_Rgba, test_rgBa, 3, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 7: 4 channel equal (zero)
// Should result: True
sub_result = test_color_equal(test_rgba, test_rgba, 4, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 8: 4 channel equal (nonzero)
// Should result: True
sub_result = test_color_equal(test_rgbA, test_rgbA, 4, TRUE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
// Test 9: 4 channel nonequal
// Should result: False
sub_result = test_color_equal(test_Rgba, test_rgbA, 4, FALSE);
*result &= sub_result;
- TEST_RESULT("COLOR_EQUAL",sub_result, *test_count, (*test_pass));
+ TEST_RESULT("COLOR_EQUAL", sub_result, *test_count, (*test_pass));
}
// Meta test function
-bool_t TEST_lib_color()
-{
+bool_t TEST_lib_color() {
TestCount_t test_count = 0;
TestCount_t test_pass = 0;
bool_t result = TRUE;