diff options
author | Christian C <cc@localhost> | 2025-03-08 00:32:06 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-08 00:32:06 -0800 |
commit | cf82fccd175e7276e97434985b345b4fcc6229ce (patch) | |
tree | 298636ab9104d4db1809e46496c16062c2e06c09 | |
parent | 140754bc0f265696b4d76e674bf580cfb544d897 (diff) |
Format testing
-rw-r--r-- | src/test/test.c | 2 | ||||
-rw-r--r-- | test/lib/dir.c | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/test/test.c b/src/test/test.c index 5c30c98..9ef2534 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -1,7 +1,7 @@ #include <test/lib/color.h> #include <test/lib/dir.h> -#define _META_TEST_RESULT(name,result) if (result) { fprintf(stderr, "%s: \x1b[92mPASS\x1b[0m\n", name);} else { fprintf(stderr, "%s: \x1b[91mFAIL\x1b[0m\n", name);} +#define _META_TEST_RESULT(name,result) if (result) { fprintf(stderr, " \x1b[92mPASS\x1b[0m %s\n", name);} else { fprintf(stderr, "%s: \x1b[91mFAIL\x1b[0m\n", name);} int main() { diff --git a/test/lib/dir.c b/test/lib/dir.c index 975b05e..66ce672 100644 --- a/test/lib/dir.c +++ b/test/lib/dir.c @@ -15,10 +15,12 @@ bool_t test_is_directory(char* dirname, bool_t result) void _TEST_is_directory(bool_t* result, uint16_t* test_count, uint16_t* test_pass) { bool_t sub_result; + // Test 1: sample_data/ (TRUE) [On clean git folder] sub_result = test_is_directory("sample_data", TRUE); *result &= sub_result; TEST_RESULT("IS_DIRECTORY",sub_result, *test_count, (*test_pass)); + // Test 2: asdf/ (FALSE) [On clean git folder] sub_result = test_is_directory("asdf", FALSE); *result &= sub_result; TEST_RESULT("IS_DIRECTORY",sub_result, *test_count, (*test_pass)); @@ -38,6 +40,7 @@ bool_t test_full_path(char* dirname, char* file, char* result) void _TEST_full_path(bool_t* result, uint16_t* test_count, uint16_t* test_pass) { bool_t sub_result; + // Test 1: sample_data/small + small.tif = sample_data/small/small.tif sub_result = test_full_path("sample_data/small", "small.tif", "sample_data/small/small.tif"); *result &= sub_result; TEST_RESULT("FULL_PATH",sub_result, *test_count, (*test_pass)); @@ -57,12 +60,17 @@ bool_t test_is_tif_ext(char* file_name, bool_t result) void _TEST_is_tif_ext(bool_t* result, uint16_t* test_count, uint16_t* test_pass) { bool_t sub_result; + // Test 1: sample_data/small/small.tif (TRUE) sub_result = test_is_tif_ext("sample_data/small/small.tif", TRUE); *result &= sub_result; TEST_RESULT("IS_TIF_EXT",sub_result, *test_count, (*test_pass)); + + // Test 2: data/test.tif (TRUE) sub_result = test_is_tif_ext("data/test.tif", TRUE); *result &= sub_result; TEST_RESULT("IS_TIF_EXT",sub_result, *test_count, (*test_pass)); + + // Test 3: sample_data/small/small (FALSE) sub_result = test_is_tif_ext("sample_data/small/small", FALSE); *result &= sub_result; TEST_RESULT("IS_TIF_EXT",sub_result, *test_count, (*test_pass)); |