ANSI colors in test program output
This commit is contained in:
parent
7e276e105a
commit
bf8347e4d9
@ -98,6 +98,10 @@ void init(void)
|
|||||||
#endif /* ENABLE_FILENAMES_ICONV */
|
#endif /* ENABLE_FILENAMES_ICONV */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ESC_GREEN "\033[32m"
|
||||||
|
#define ESC_RED "\033[31m"
|
||||||
|
#define ESC_RESET "\033[0m"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test program entry point
|
* Test program entry point
|
||||||
*/
|
*/
|
||||||
@ -116,21 +120,21 @@ int main(int argc, char * * argv)
|
|||||||
printf("Testing %s :\n", tests[i].test_name);
|
printf("Testing %s :\n", tests[i].test_name);
|
||||||
r = tests[i].test_func();
|
r = tests[i].test_func();
|
||||||
if (r)
|
if (r)
|
||||||
printf("OK\n");
|
printf(ESC_GREEN "OK" ESC_RESET "\n");
|
||||||
else {
|
else {
|
||||||
printf("FAILED\n");
|
printf(ESC_RED "FAILED" ESC_RESET "\n");
|
||||||
fail++;
|
fail++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fail == 0)
|
if (fail == 0)
|
||||||
{
|
{
|
||||||
printf("All tests succesfull\n");
|
printf(ESC_GREEN "All tests succesfull" ESC_RESET "\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("%d tests failed\n", fail);
|
printf(ESC_RED "%d tests failed" ESC_RESET "\n", fail);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user