aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2014-05-17 15:54:16 +0300
committerOskari Timperi <oskari.timperi@iki.fi>2014-05-17 15:54:16 +0300
commit35c41f87bdadc49a8fcd8fcd8ed284f118416b46 (patch)
treedcd63d4191bc7eb28079b36c7663edecb58004cf
parent7beddab435eb1e1455fcd8ee6cbb83f395e4d537 (diff)
downloadlispish-35c41f87bdadc49a8fcd8fcd8ed284f118416b46.tar.gz
lispish-35c41f87bdadc49a8fcd8fcd8ed284f118416b46.zip
test_util.h: allow multiple tests to run even if asserts fail and print failures in red
-rw-r--r--test_util.h9
1 files 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)