aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/helpers.h
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-11 00:04:08 +0900
committernsfisis <nsfisis@gmail.com>2025-09-11 00:35:34 +0900
commitb3efe5b6c04e809ba0a67308994c91adfbd15eff (patch)
tree5ac9bf1702a21e9a952bce90ee934dc3bd455a42 /tests/helpers.h
parent9a2fbf6f4854b1f2cfd5979b91d5b3d7e183d487 (diff)
downloadducc-b3efe5b6c04e809ba0a67308994c91adfbd15eff.tar.gz
ducc-b3efe5b6c04e809ba0a67308994c91adfbd15eff.tar.zst
ducc-b3efe5b6c04e809ba0a67308994c91adfbd15eff.zip
test: rewrite some tests in C language
Diffstat (limited to 'tests/helpers.h')
-rw-r--r--tests/helpers.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/helpers.h b/tests/helpers.h
new file mode 100644
index 0000000..f8affe7
--- /dev/null
+++ b/tests/helpers.h
@@ -0,0 +1,20 @@
+#ifndef DUCC_TESTS_HELPERS_H
+#define DUCC_TESTS_HELPERS_H
+
+void exit(int);
+struct FILE;
+typedef struct FILE FILE;
+int fprintf(FILE*, const char*, ...);
+extern FILE* stderr;
+
+#define ASSERT(a, file, line) \
+ do { \
+ if (!(a)) { \
+ fprintf(stderr, "%s:%d: assert failed", file, line); \
+ exit(1); \
+ } \
+ } while (0)
+
+#define ASSERT_EQ(a, b) ASSERT((a) == (b), __FILE__, __LINE__)
+
+#endif