From d46b48a448deb539aaf93acc4425972e10bf5061 Mon Sep 17 00:00:00 2001 From: Tharre Date: Fri, 25 Apr 2014 01:34:52 +0200 Subject: Add assert equal macros to dbg.h --- src/dbg.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/dbg.h') 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 -- cgit v1.2.3-70-g09d2