Browse code

Reformat assert macro

John Hawthorn authored on 27/09/2014 23:43:40
Showing 1 changed files

... ...
@@ -7,7 +7,13 @@
7 7
 
8 8
 int testsrun = 0, testsfailed = 0, assertionsrun = 0;
9 9
 
10
-#define assert(x) if(++assertionsrun && !(x)){fprintf(stderr, "test \"%s\" failed\n   assert(%s) was false\n   at %s:%i\n\n", __func__, #x, __FILE__ ,__LINE__);raise(SIGTRAP);testsfailed++;return;}
10
+#define assert(x) \
11
+	if(++assertionsrun && !(x)){ \
12
+		fprintf(stderr, "test \"%s\" failed\n   assert(%s) was false\n   at %s:%i\n\n", __func__, #x, __FILE__ ,__LINE__); \
13
+		raise(SIGTRAP); \
14
+		testsfailed++; \
15
+		return; \
16
+	}
11 17
 
12 18
 #define assert_streq(a, b) assert(!strcmp(a, b))
13 19