aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/curlcheck.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-03 23:47:34 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-03 23:47:34 +0100
commit83e9fb21aabbec27c6ad6ef7f80ec2a6d3f815ff (patch)
tree9d1bd1a28fd87d092b58c3b5772e7a141de9b2de /tests/unit/curlcheck.h
parent5c42b2ceaeef78ca1c249523b7d9b5cd2405df58 (diff)
curlcheck.h: add fail_if() fix code
The UNITTEST_START and UNITTEST_STOP defines needed to do a new brace level so that test cases can declare variables fine and still remain fine C89 code.
Diffstat (limited to 'tests/unit/curlcheck.h')
-rw-r--r--tests/unit/curlcheck.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/unit/curlcheck.h b/tests/unit/curlcheck.h
index c34f99093..66f0d3ddb 100644
--- a/tests/unit/curlcheck.h
+++ b/tests/unit/curlcheck.h
@@ -9,6 +9,13 @@
#include "test.h"
+#define fail_if(expr, msg) \
+ if(expr) { \
+ fprintf(stderr, "%s:%d Assertion '%s' met: %s" , \
+ __FILE__, __LINE__, #expr, msg); \
+ unitfail++; \
+ }
+
#define fail_unless(expr, msg) \
if(!(expr)) { \
fprintf(stderr, "%s:%d Assertion '%s' failed: %s" , \
@@ -22,9 +29,11 @@ extern int unitfail;
int test(char *unused) \
{ \
(void)unused; \
- unit_setup();
+ unit_setup(); \
+ {
#define UNITTEST_STOP \
+ } \
unit_stop(); \
return unitfail; \
}