aboutsummaryrefslogtreecommitdiff
path: root/tests/driver.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/driver.c12
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++)