From 7eef4f04d9fd1fc8ecc38392ce1adb1c44899adc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 1 Sep 2021 11:03:49 -0300 Subject: Refactor C files, split logerr and tests-lib --- src/tests-lib.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/tests-lib.c (limited to 'src/tests-lib.c') diff --git a/src/tests-lib.c b/src/tests-lib.c new file mode 100644 index 0000000..a9d229a --- /dev/null +++ b/src/tests-lib.c @@ -0,0 +1,29 @@ +#include "config.h" +#include "tests-lib.h" +#include +#include + +#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); +} -- cgit v1.2.3