aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2014-04-25 01:34:52 +0200
committerTharre <tharre3@gmail.com>2014-04-25 02:31:01 +0200
commitd46b48a448deb539aaf93acc4425972e10bf5061 (patch)
tree64ba651586bdbecb7d7cd782572df9340db73541
parentdf54e75541786fb0d53b09706b35ed15b1cc493f (diff)
downloadredo-d46b48a448deb539aaf93acc4425972e10bf5061.tar.gz
redo-d46b48a448deb539aaf93acc4425972e10bf5061.tar.xz
redo-d46b48a448deb539aaf93acc4425972e10bf5061.zip
Add assert equal macros to dbg.h
-rw-r--r--src/dbg.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/dbg.h b/src/dbg.h
index 5573f8e..b6569ff 100644
--- a/src/dbg.h
+++ b/src/dbg.h
@@ -30,4 +30,18 @@
#define fatal_(f,l,...) \
{FATAL_HELPER_(f, l, __VA_ARGS__, strerror(errno)); exit(EXIT_FAILURE);}
+#define assert_str_equal(a,b) ({ \
+ if (strcmp(a, b)) { \
+ log_err("Assertion error: '%s' == '%s'\n", a, b); \
+ abort(); \
+ } \
+})
+
+#define assert_int_equal(a,b) ({ \
+ if (a != b) { \
+ log_err("Assertion error: '%d' == '%d'\n", a, b); \
+ abort(); \
+ } \
+})
+
#endif