Browse Source

clean pedantic warnings

master v2.0
katherine 4 years ago
parent
commit
d09a5228ed
  1. 24
      simple-test.h

24
simple-test.h

@ -250,7 +250,7 @@ static enum simple_test_type simple_test_type_resolve(enum simple_test_type t1,
#define SIMPLE_TEST_FAIL1(...) \
do { \
printf("\e[1m%*c :: at line %d, \e[m\e[1;31mfail: \e[m", \
printf("\x1B[1m%*c :: at line %d, \x1B[m\x1B[1;31mfail: \x1B[m", \
simple_test_pad_width, ' ', __LINE__); \
printf(__VA_ARGS__); \
printf("\n"); \
@ -258,8 +258,8 @@ static enum simple_test_type simple_test_type_resolve(enum simple_test_type t1,
#define SIMPLE_TEST_PRINT_VAL(w, s, t) \
do { \
printf("\e[1m%*c :: ", simple_test_pad_width, ' '); \
printf("`%s` \e[m== \e[1m", s); \
printf("\x1B[1m%*c :: ", simple_test_pad_width, ' '); \
printf("`%s` \x1B[m== \x1B[1m", s); \
switch (t) { \
case SIMPLE_TEST_BOOL: \
printf("%s", (w ? simple_test_il : simple_test_ir) \
@ -285,7 +285,7 @@ static enum simple_test_type simple_test_type_resolve(enum simple_test_type t1,
default: \
break; \
} \
printf("\e[m\n"); \
printf("\x1B[m\n"); \
} while (0)
#define SIMPLE_TEST_FAIL2 \
@ -296,11 +296,11 @@ static enum simple_test_type simple_test_type_resolve(enum simple_test_type t1,
#define SIMPLE_TEST_ERR(...) \
do { \
printf("\e[1m%*c :: at line %d, \e[m\e[1;31merr: \e[m", \
printf("\x1B[1m%*c :: at line %d, \x1B[m\x1B[1;31merr: \x1B[m", \
simple_test_pad_width, ' ', __LINE__); \
printf(__VA_ARGS__); \
printf("\n"); \
printf("\e[1;31mtesting aborted\e[m\n"); \
printf("\x1B[1;31mtesting aborted\x1B[m\n"); \
exit(1); \
} while (0)
@ -380,7 +380,7 @@ static enum simple_test_type simple_test_type_resolve(enum simple_test_type t1,
do { \
simple_test_test_current_at = 0; \
if (simple_test_pass_number == 0) { \
printf("\e[1mstarting tests in " __FILE__ "...\n"); \
printf("\x1B[1mstarting tests in " __FILE__ "...\n"); \
} else { \
simple_test_pad_width = sprintf(simple_test_print_buf, \
"%d", simple_test_test_count) + 1; \
@ -401,7 +401,7 @@ static enum simple_test_type simple_test_type_resolve(enum simple_test_type t1,
simple_test_test_count++; \
} else if (simple_test_pass_number \
== simple_test_test_current_at) { \
printf("\e[m%*d \e[1m:: \e[m\e[33m%s\e[m\n", simple_test_pad_width, \
printf("\x1B[m%*d \x1B[1m:: \x1B[m\x1B[33m%s\x1B[m\n", simple_test_pad_width, \
simple_test_test_current++, description); \
/* must appear after all tests */
@ -418,20 +418,20 @@ simple_test_loop_end: \
(void)0; \
} while (simple_test_pass_number++ < simple_test_test_count); \
if (simple_test_fail_count) { \
printf("\e[1;31m%d of %d tests failed\e[m\n", \
printf("\x1B[1;31m%d of %d tests failed\x1B[m\n", \
simple_test_fail_count, simple_test_test_count); \
return 1; \
} else { \
printf("\e[1;32mall tests passed!\e[m\n"); \
printf("\x1B[1;32mall tests passed!\x1B[m\n"); \
return 0; \
} \
}
#define ECHO(...) \
do { \
printf("\e[1m%*c :: \e[m\e[34m", simple_test_pad_width, ' '); \
printf("\x1B[1m%*c :: \x1B[m\x1B[34m", simple_test_pad_width, ' '); \
printf(__VA_ARGS__); \
printf("...\e[m\n"); \
printf("...\x1B[m\n"); \
} while (0)

Loading…
Cancel
Save