aboutsummaryrefslogtreecommitdiff
path: root/tests/test.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-30 04:30:33 +0200
committerhachem <im@hachem.wtf>2026-08-30 04:30:33 +0200
commit2b5a8a428cbbdda8ef0efa7b2c77c100b8dbfa0c (patch)
treeca0ed5be92ae59c9609ff4eaa3f86ce2f3cb4b03 /tests/test.h
parentaffa20ab497911353babc9ed6c580c8a12b2bf15 (diff)
test: add lexer testing
Diffstat (limited to 'tests/test.h')
-rw-r--r--tests/test.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test.h b/tests/test.h
new file mode 100644
index 0000000..c5e2e73
--- /dev/null
+++ b/tests/test.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <stdio.h>
+
+struct TestContext
+{
+ int checks;
+ int failures;
+};
+
+#define check(context, condition) \
+ do \
+ { \
+ (context)->checks += 1; \
+ if (!(condition)) \
+ { \
+ (context)->failures += 1; \
+ printf(" FAIL %s:%d: %s\n", __FILE__, __LINE__, #condition); \
+ } \
+ } \
+ while (0)