aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/common.h b/common.h
index f39090e..a940151 100644
--- a/common.h
+++ b/common.h
@@ -29,3 +29,16 @@ eq(double a, double b)
{
return b - DOUBLE_TOLERANCE <= a && a <= b + DOUBLE_TOLERANCE;
}
+
+
+#ifdef TEST
+
+# define ASSERT(ASSERTION)\
+ do {\
+ if (!(ASSERTION)) {\
+ fprintf(stderr, "Failed assertion at line %u: %s\n", __LINE__, #ASSERTION);\
+ exit(1);\
+ }\
+ } while (0)
+
+#endif