diff options
Diffstat (limited to 'include/test')
-rw-r--r-- | include/test/__meta__.h | 18 | ||||
-rw-r--r-- | include/test/lib/color.h | 9 | ||||
-rw-r--r-- | include/test/lib/dir.h | 9 | ||||
-rw-r--r-- | include/test/lib/time.h | 6 |
4 files changed, 28 insertions, 14 deletions
diff --git a/include/test/__meta__.h b/include/test/__meta__.h index 17e0b99..f0c10b4 100644 --- a/include/test/__meta__.h +++ b/include/test/__meta__.h @@ -2,21 +2,29 @@ #define INC_TEST___META___H #include <lib/bool.h> -#include <stdio.h> #include <stddef.h> +#include <stdio.h> #define TestCount_t uint16_t #ifdef TEST_SHOW_PASS -#define _TEST_PASS(s,sub,n) fprintf(stderr, "(%4X) \x1b[92mPASS\x1b[0m %s/%s\n", ++n, s, sub) +#define _TEST_PASS(s, sub, n) \ + fprintf(stderr, "(%4X) \x1b[92mPASS\x1b[0m %s/%s\n", ++n, s, sub) #else -#define _TEST_PASS(s,sub,n) ++n +#define _TEST_PASS(s, sub, n) ++n #endif -#define _TEST_FAIL(s,sub,n) fprintf(stderr, "(%4X) \x1b[91mFAIL\x1b[0m %s/%s\n", ++n, s, sub) +#define _TEST_FAIL(s, sub, n) \ + fprintf(stderr, "(%4X) \x1b[91mFAIL\x1b[0m %s/%s\n", ++n, s, sub) #ifndef _TEST_RESULT -#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++;} +#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 2e9b863..e1598cb 100644 --- a/include/test/lib/color.h +++ b/include/test/lib/color.h @@ -3,14 +3,17 @@ #include <test/__meta__.h> #ifndef TEST_RESULT -#define TEST_RESULT(subtest,result,n,n_success) _TEST_RESULT("LIB/COLOR",subtest,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> #include <lib/data/image_types.h> -bool_t test_color_zero(const ImageData_t* color1, 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 test_color_zero(const ImageData_t *color1, 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); // Meta test function bool_t TEST_lib_color(); diff --git a/include/test/lib/dir.h b/include/test/lib/dir.h index 64482df..6d46267 100644 --- a/include/test/lib/dir.h +++ b/include/test/lib/dir.h @@ -3,14 +3,15 @@ #include <test/__meta__.h> #ifndef TEST_RESULT -#define TEST_RESULT(subtest,result,n,n_success) _TEST_RESULT("LIB/DIR",subtest,result,n,n_success) +#define TEST_RESULT(subtest, result, n, n_success) \ + _TEST_RESULT("LIB/DIR", subtest, result, n, n_success) #endif #include <lib/dir.h> -bool_t test_is_directory(char* dirname, bool_t result); -bool_t test_full_path(char* dirname, char* file, char* result); -bool_t test_is_tif_ext(char* file_name, bool_t result); +bool_t test_is_directory(char *dirname, bool_t result); +bool_t test_full_path(char *dirname, char *file, char *result); +bool_t test_is_tif_ext(char *file_name, bool_t result); // Meta test function bool_t TEST_lib_dir(); diff --git a/include/test/lib/time.h b/include/test/lib/time.h index cdf464e..d242c65 100644 --- a/include/test/lib/time.h +++ b/include/test/lib/time.h @@ -3,12 +3,14 @@ #include <test/__meta__.h> #ifndef TEST_RESULT -#define TEST_RESULT(subtest,result,n,n_success) _TEST_RESULT("LIB/TIME",subtest,result,n,n_success) +#define TEST_RESULT(subtest, result, n, n_success) \ + _TEST_RESULT("LIB/TIME", subtest, result, n, n_success) #endif #include <lib/time.h> -bool_t test_diff_time(const struct timespec *time1, const struct timespec *time0, double result); +bool_t test_diff_time(const struct timespec *time1, + const struct timespec *time0, double result); // Meta test function bool_t TEST_lib_time(); |