From 35c41f87bdadc49a8fcd8fcd8ed284f118416b46 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Sat, 17 May 2014 15:54:16 +0300 Subject: test_util.h: allow multiple tests to run even if asserts fail and print failures in red --- test_util.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test_util.h b/test_util.h index f3247aa..2a652de 100644 --- a/test_util.h +++ b/test_util.h @@ -63,12 +63,15 @@ return 0; \ } +#define FG_RED "\x1b[31m" +#define FG_RESET "\x1b[39m" + #define ASSERT(X) \ do { \ if (!(X)) { \ - fprintf(stderr, "assertion %s failed at %s:%d\n", \ + fprintf(stderr, FG_RED "assertion %s failed at %s:%d\n" FG_RESET, \ #X, __FILE__, __LINE__); \ - exit(1); \ + return; \ } \ } while (0) @@ -77,7 +80,7 @@ if (!(X)) { \ fprintf(stderr, "assertion %s failed at %s:%d (" FMT ")\n", \ #X, __FILE__, __LINE__, ##__VA_ARGS__); \ - exit(1); \ + return; \ } \ } while (0) -- cgit v1.2.3