diff options
author | EuAndreh <eu@euandre.org> | 2021-08-21 05:46:01 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-08-21 05:49:01 -0300 |
commit | 8cdf1afb795cf4f2d6eb01fa6a533d9321adec59 (patch) | |
tree | 22d8eb5f33eed5b7bfe513430002d679bf8460ec /src/tests-lib.c | |
parent | TODOs.md: Add #task-a0634ded-968e-bce5-3fef-8e1c5e3aab35 (diff) | |
download | gistatic-8cdf1afb795cf4f2d6eb01fa6a533d9321adec59.tar.gz gistatic-8cdf1afb795cf4f2d6eb01fa6a533d9321adec59.tar.xz |
src/tests-lib.c: Move testing helper function and share it with other files
Diffstat (limited to 'src/tests-lib.c')
-rw-r--r-- | src/tests-lib.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests-lib.c b/src/tests-lib.c new file mode 100644 index 0000000..21e6a8f --- /dev/null +++ b/src/tests-lib.c @@ -0,0 +1,26 @@ +#include "config.h" +#include "tests-lib.h" +#include <stdio.h> +#include <assert.h> + +#define COLOUR_RESET "\033[0m" +#define COLOUR_GREEN "\033[0;32m" +#define COLOUR_YELLOW "\033[0;33m" + +void test_start(const char *const name) { + assert(fprintf(stderr, "%s():\n", name) > 0); +} + +void testing(const char *const message) { + assert( + fprintf( + stderr, + COLOUR_YELLOW "testing" COLOUR_RESET ": %s...", + message + ) > 0 + ); +} + +void test_ok(void) { + assert(fprintf(stderr, " " COLOUR_GREEN "OK" COLOUR_RESET ".\n") > 0); +} |