summaryrefslogtreecommitdiff
path: root/tests/main.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-09-14 22:08:22 -0400
committerpommicket <pommicket@gmail.com>2025-09-14 22:08:22 -0400
commit969bf523b7039c7038b66edde5776278c27941ac (patch)
tree89a9754ff69046c813f238bff424be7cec722cdb /tests/main.c
parent0302aca4e1aa3eb495970af40a63f8bf4cf95779 (diff)
Start tests
Diffstat (limited to 'tests/main.c')
-rw-r--r--tests/main.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/main.c b/tests/main.c
new file mode 100644
index 0000000..7b791cd
--- /dev/null
+++ b/tests/main.c
@@ -0,0 +1,26 @@
+#include "test.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+static bool any_failure = false;
+
+void test_fail(const char *fmt, ...) {
+ any_failure = true;
+ fprintf(stderr, "\x1b[1m\x1b[91mFailure:\x1b[0m ");
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fprintf(stderr, "\n");
+}
+
+int main(void) {
+ const char *test_dir = "../tests";
+ test_parsing(test_dir);
+ if (any_failure) {
+ fprintf(stderr, "\x1b[1m\x1b[91mSome tests failed.\x1b[0m\n");
+ } else {
+ printf("\x1b[1m\x1b[92mAll tests OK\x1b[0m\n");
+ }
+}