summaryrefslogtreecommitdiff
path: root/src/lily-test.h
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2021-12-21 01:00:11 -0600
committersanine <sanine.not@pm.me>2021-12-21 01:00:11 -0600
commit781b61d0d0131c880d54bd9667fb0b9c81643ba7 (patch)
treecc751806eaa29cffd6f5d6791c5f79083feb505a /src/lily-test.h
initial commit
Diffstat (limited to 'src/lily-test.h')
-rw-r--r--src/lily-test.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lily-test.h b/src/lily-test.h
new file mode 100644
index 0000000..8ce0f41
--- /dev/null
+++ b/src/lily-test.h
@@ -0,0 +1,30 @@
+#ifndef LILY_TEST_H
+#define LILY_TEST_H
+
+#define lily_test const char *
+
+struct lily_test_data_t {
+ int tests_run;
+ int tests_failed;
+};
+
+#define LILY_INIT() \
+ struct lily_test_data_t lily_test_data = { 0, 0 };
+
+
+// helper macros to turn numerical constants into strings
+#define STR_IMPL(x) #x
+#define STR(X) STR_IMPL(x)
+
+
+// assertion macros
+#define lily_indent " "
+#define lily_assert(statement, message) \
+ do { \
+ if (!(statement)) \
+ return "" message \
+ "\n" lily_indent " [" __FILE__ ":" STR(__LINE__) "]"; \
+ } while(0)
+
+
+#endif