aboutsummaryrefslogtreecommitdiffstats
path: root/test/packetdrill/assert.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/packetdrill/assert.h')
-rw-r--r--test/packetdrill/assert.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/packetdrill/assert.h b/test/packetdrill/assert.h
new file mode 100644
index 0000000..9d03822
--- /dev/null
+++ b/test/packetdrill/assert.h
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void __attribute__((noreturn)) die(char *format, ...);
+
+#define assert(expr) \
+ do { \
+ if (!(expr)) \
+ die("assertion %s failed at %s line %d",\
+ __STRING(expr), __FILE__, __LINE__);\
+ } while (0)