From edf331cd2573726d8053ce76e3497203a12d99b9 Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Thu, 12 Mar 2020 09:14:29 +0100 Subject: add test for hashmap --- tests/test.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test.h (limited to 'tests/test.h') diff --git a/tests/test.h b/tests/test.h new file mode 100644 index 0000000..19868f8 --- /dev/null +++ b/tests/test.h @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +#define assert(assertion, format, ...) _assert(assertion, __FILE__, __LINE__, format, ##__VA_ARGS__) +#define TESTNAME(v) strcpy(current_test, v); + +char current_test[256] = {'\0'}; + +void _assert(int assertion, const char filename[64], const int line, char *format, ...) +{ + if (assertion) + { + return; + } + + va_list args; + va_start(args, format); + printf("%s:%d:%s failed: ", filename, line, current_test); + vprintf(format, args); + va_end(args); + printf("\n"); +} \ No newline at end of file -- cgit v1.2.3