From 6c11d4503758079f29ce2b0b0509d2a128ada662 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Sat, 6 Aug 2022 17:25:22 +0400 Subject: test --- source/kit_test/run_tests.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source/kit_test/run_tests.c') diff --git a/source/kit_test/run_tests.c b/source/kit_test/run_tests.c index 191982a..19fea96 100644 --- a/source/kit_test/run_tests.c +++ b/source/kit_test/run_tests.c @@ -5,7 +5,7 @@ struct kit_tests_list kit_tests_list = { 0 }; -static void report(int i, char const *file, int line, bool ok) { +static void report(int i, char const *file, int line, _Bool ok) { int const n = kit_tests_list.tests[i].assertions++; kit_tests_list.tests[i].file[n] = file; @@ -23,7 +23,7 @@ static long long sec_to_ms(long long sec) { enum code_value { white, yellow, red, green }; -static void color_code(bool term_color, int c) { +static void color_code(_Bool term_color, int c) { if (term_color) { if (c == white) printf("\x1b[37m"); @@ -37,15 +37,15 @@ static void color_code(bool term_color, int c) { } int kit_run_tests(int argc, char **argv) { - int fail_test_count = 0; - int fail_assertion_count = 0; - int total_assertion_count = 0; - int status = 0; - bool term_color = true; + int fail_test_count = 0; + int fail_assertion_count = 0; + int total_assertion_count = 0; + int status = 0; + _Bool term_color = 1; for (int i = 0; i < argc; i++) if (strcmp("--no-term-color", argv[i]) == 0) - term_color = false; + term_color = 0; for (int i = 0; i < kit_tests_list.size; i++) { color_code(term_color, yellow); @@ -63,17 +63,17 @@ int kit_run_tests(int argc, char **argv) { printf("\r"); - bool test_status = true; + _Bool test_status = 1; for (int j = 0; j < kit_tests_list.tests[i].assertions; j++) - if (kit_tests_list.tests[i].status[j] == false) { + if (kit_tests_list.tests[i].status[j] == 0) { fail_assertion_count++; - test_status = false; + test_status = 0; } total_assertion_count += kit_tests_list.tests[i].assertions; - if (test_status == false) { + if (test_status == 0) { color_code(term_color, red); printf("[ RUN ] %s\n", kit_tests_list.tests[i].test_name); printf("[ FAILED ] %s - %d ms\n", -- cgit v1.2.3