diff options
author | axtloss <axtlos@disroot.org> | 2024-10-17 02:39:27 +0200 |
---|---|---|
committer | axtloss <axtlos@disroot.org> | 2024-10-17 02:39:27 +0200 |
commit | 7f0fc08c05142f9f70cb05a4b1b1d6f0b1a3279b (patch) | |
tree | 0c1934e2d6940a99e97f2adefdac46cd3b9e384d /tests/driver.c | |
parent | b2182396df5d99ff5c26161aaffa5ced879742c5 (diff) | |
download | extlib-7f0fc08c05142f9f70cb05a4b1b1d6f0b1a3279b.tar.gz extlib-7f0fc08c05142f9f70cb05a4b1b1d6f0b1a3279b.tar.bz2 |
Add strfmt
Diffstat (limited to '')
-rw-r--r-- | tests/driver.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/driver.c b/tests/driver.c index d3739b5..4d998b8 100644 --- a/tests/driver.c +++ b/tests/driver.c @@ -6,9 +6,8 @@ #include "../src/extlib.h" #include "test_driver.h" -const char* success = "\033[1;32m"; -const char* fail = " \033[1;31m"; -const char *reset = "\033[0m"; +char* success; +char* fail; int tests_count; struct test_t** registered_tests; @@ -19,9 +18,9 @@ test_runner (struct test_t *test, int n) printf ("Test Case %d: %s -- %s\n", n, test->test_name, test->test_desc); int test_result = test->test_func(); if (test_result == 0) - printf ("Test Case %d: %s -- %sSUCCESS%s\n\n", n, test->test_name, success, reset); + printf ("Test Case %d: %s -- %s\n\n", n, test->test_name, success); else - printf ("Test Case %d: %s -- %sFAIL %d%s\n\n", n, test->test_name, fail, test_result, reset); + printf ("Test Case %d: %s -- %s %d\n\n", n, test->test_name, fail, test_result); } void @@ -36,6 +35,9 @@ register_test (struct test_t *test) int main (int argc, char *argv[]) { + success = strfmt("SUCCESS", (struct style) {.color = GREEN, .background = false, .styles = BOLD|UNDERLINE}); + fail = strfmt("FAIL", (struct style) {.color = RED, .background = false, .styles = BOLD|UNDERLINE}); + registered_tests = malloc (8); tests_entrypoint(); for (int i = 0; i < tests_count; i++) |