From 8f17684810718973c8ea0f1150e46d6c1b8c0ef1 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 7 Aug 2020 22:47:46 +0200 Subject: server: Add basic unit test framework --- test/test_framework.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/test_framework.c (limited to 'test/test_framework.c') diff --git a/test/test_framework.c b/test/test_framework.c new file mode 100644 index 0000000..8cd53ac --- /dev/null +++ b/test/test_framework.c @@ -0,0 +1,14 @@ +#include +#include +#include "test_framework.h" + + +extern atomic_flag test_framework_assertion_failed; + + +void test_report_error( + const char *type, const char *condition, const char *fname, int lineno) { + printf("\x1B[31;1m%s:%d: Assertion failed:\n %s(%s)\x1B[0m\n", + fname, lineno, type, condition); + atomic_flag_test_and_set(&test_framework_assertion_failed); +} -- cgit v1.2.3-54-g00ecf