From 2e5d21d309aa930136849f5f7f34103535094026 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Fri, 5 Aug 2022 22:19:59 -0400 Subject: [PATCH] Add extremely basic unit test framework. --- tests/UnitTest.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/UnitTest.h diff --git a/tests/UnitTest.h b/tests/UnitTest.h new file mode 100644 index 0000000..fe22dd2 --- /dev/null +++ b/tests/UnitTest.h @@ -0,0 +1,14 @@ +#ifndef TELODENDRIA_UNITTEST_H +#define TELODENDRIA_UNITTEST_H + +#include +#include + +#define TEST(body) int main(void) { body; return 0; } + +#define ASSERT(condition) if (!(condition)) { \ + printf("%s:%d: Assertion failed: %s\n", __FILE__, __LINE__, #condition); \ + exit(1); \ +} + +#endif