aboutsummaryrefslogtreecommitdiff
path: root/src/tests-lib.c
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-09-01 11:03:49 -0300
committerEuAndreh <eu@euandre.org>2021-09-01 11:07:11 -0300
commit7eef4f04d9fd1fc8ecc38392ce1adb1c44899adc (patch)
tree7366fac128a49fb2b128090ca6b69f147ebfe583 /src/tests-lib.c
parenttests/lib.sh: Update (diff)
downloadremembering-7eef4f04d9fd1fc8ecc38392ce1adb1c44899adc.tar.gz
remembering-7eef4f04d9fd1fc8ecc38392ce1adb1c44899adc.tar.xz
Refactor C files, split logerr and tests-lib
Diffstat (limited to 'src/tests-lib.c')
-rw-r--r--src/tests-lib.c29
1 files changed, 29 insertions, 0 deletions
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 <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);
+}