Skip to content

Commit 8c3623d

Browse files
fix names for color output
1 parent f8dc3ea commit 8c3623d

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

code/logic/fossil/test/testing.h

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,22 @@
1818
#define MAX_NAME_LENGTH 256
1919

2020
// Color codes
21-
#define COLOR_RESET "\033[0m"
22-
#define COLOR_PASS "\033[32m" // Green
23-
#define COLOR_FAIL "\033[31m" // Red
24-
#define COLOR_SKIP "\033[33m" // Yellow
25-
#define COLOR_INFO "\033[34m" // Blue
26-
#define COLOR_BDD "\033[35m" // Magenta
27-
#define COLOR_CYAN "\033[36m" // Cyan
21+
#define FOSSIL_TEST_COLOR_RESET "\033[0m" // Reset
22+
#define FOSSIL_TEST_COLOR_GREEN "\033[32m" // Green
23+
#define FOSSIL_TEST_COLOR_RED "\033[31m" // Red
24+
#define FOSSIL_TEST_COLOR_YELLOW "\033[33m" // Yellow
25+
#define FOSSIL_TEST_COLOR_BLUE "\033[34m" // Blue
26+
#define FOSSIL_TEST_COLOR_MAGENTA "\033[35m" // Magenta
27+
#define FOSSIL_TEST_COLOR_CYAN "\033[36m" // Cyan
28+
#define FOSSIL_TEST_COLOR_WHITE "\033[97m" // White
29+
#define FOSSIL_TEST_COLOR_PURPLE "\033[35m" // Purple
30+
#define FOSSIL_TEST_COLOR_ORANGE "\033[38;5;208m" // Orange
31+
32+
#define FOSSIL_TEST_ATTR_BOLD "\033[1m" // Bold
33+
#define FOSSIL_TEST_ATTR_DIM "\033[2m" // Dim
34+
#define FOSSIL_TEST_ATTR_UNDERLINE "\033[4m" // Underline
35+
#define FOSSIL_TEST_ATTR_ITATIC "\033[3m" // Italic
36+
2837

2938
#include <setjmp.h>
3039
#include <stddef.h>
@@ -54,6 +63,7 @@ typedef enum {
5463
TEST_STATUS_PASS,
5564
TEST_STATUS_FAIL,
5665
TEST_STATUS_SKIP,
66+
TEST_STATUS_EMPTY,
5767
TEST_STATUS_TTIMEOUT
5868
} test_status_t;
5969

@@ -95,6 +105,7 @@ typedef struct fossil_test_env {
95105
int pass_count;
96106
int fail_count;
97107
int skip_count;
108+
int empty_count;
98109
int timeout_count;
99110
int unexpected_count;
100111
double start_execution_time;
@@ -229,7 +240,7 @@ void fossil_test_print_stack_trace(stack_frame_t *stack_trace);
229240
#define _FOSSIL_TEST_SKIP(test_name, message) \
230241
test_name##_test_case.status = TEST_STATUS_SKIP; \
231242
test_name##_test_case.failure_message = message; \
232-
printf(COLOR_SKIP "SKIP: %s - %s\n" COLOR_RESET, #test_name, message); \
243+
printf(FOSSIL_TEST_COLOR_YELLOW "SKIP: %s - %s\n" FOSSIL_TEST_COLOR_RESET, #test_name, message); \
233244

234245
/**
235246
* @brief Macro to define a test case.
@@ -447,7 +458,7 @@ void fossil_test_print_stack_trace(stack_frame_t *stack_trace);
447458
*/
448459
#define _GIVEN(description) \
449460
if (0) { \
450-
printf(COLOR_BDD "Given %s\n" COLOR_RESET, description); \
461+
printf(FOSSIL_TEST_COLOR_MAGENTA "Given %s\n" FOSSIL_TEST_COLOR_RESET, description); \
451462
}
452463

453464
/**
@@ -460,7 +471,7 @@ void fossil_test_print_stack_trace(stack_frame_t *stack_trace);
460471
*/
461472
#define _WHEN(description) \
462473
if (0) { \
463-
printf(COLOR_BDD "When %s\n" COLOR_RESET, description); \
474+
printf(FOSSIL_TEST_COLOR_MAGENTA "When %s\n" FOSSIL_TEST_COLOR_RESET, description); \
464475
}
465476

466477
/**
@@ -473,7 +484,7 @@ void fossil_test_print_stack_trace(stack_frame_t *stack_trace);
473484
*/
474485
#define _THEN(description) \
475486
if (0) { \
476-
printf(COLOR_BDD "Then %s\n" COLOR_RESET, description); \
487+
printf(FOSSIL_TEST_COLOR_MAGENTA "Then %s\n" FOSSIL_TEST_COLOR_RESET, description); \
477488
}
478489

479490
#ifdef __cplusplus

0 commit comments

Comments
 (0)