From acc0885e520cc887d8977b53311b19e6608f1457 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Thu, 28 May 2020 11:47:13 +0300 Subject: [PATCH] tests: add option to disable colors in test output * because some terminals may not support colors, in that case, colors can be disabled by defining `GLM_TESTS_NO_COLORFUL_OUTPUT` --- test/include/common.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/include/common.h b/test/include/common.h index eb13bfa..4b61250 100644 --- a/test/include/common.h +++ b/test/include/common.h @@ -38,6 +38,8 @@ typedef struct test_entry_t { int show_output; } test_entry_t; +#ifndef GLM_TESTS_NO_COLORFUL_OUTPUT + #define RESET "\033[0m" #define BLACK "\033[30m" /* Black */ #define RED "\033[31m" /* Red */ @@ -56,6 +58,28 @@ typedef struct test_entry_t { #define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */ #define BOLDWHITE "\033[1m\033[37m" /* Bold White */ +#else + +#define RESET +#define BLACK +#define RED +#define GREEN +#define YELLOW +#define BLUE +#define MAGENTA +#define CYAN +#define WHITE +#define BOLDBLACK +#define BOLDRED +#define BOLDGREEN +#define BOLDYELLOW +#define BOLDBLUE +#define BOLDMAGENTA +#define BOLDCYAN +#define BOLDWHITE + +#endif + #define TEST_DECLARE(FUN) test_status_t test_ ## FUN(void); #define TEST_ENTRY(FUN) { #FUN, test_ ## FUN, 0, 0 }, #define TEST_LIST static test_entry_t tests[] =