From: Philip Chimento Date: Sat, 26 Oct 2013 05:24:28 +0000 (-0700) Subject: Print more informative assert message X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=9ee259d9a29d83d79d912d1716b4044c63e90343;p=projects%2Fchimara%2Fchimara.git Print more informative assert message ASSERT_EQUAL() is for int-like types that will print with %d. --- diff --git a/tests/unit/glkunit.h b/tests/unit/glkunit.h index 3828987..e50d19f 100644 --- a/tests/unit/glkunit.h +++ b/tests/unit/glkunit.h @@ -15,7 +15,10 @@ #define SUCCEED _BEGIN return 1; _END #define ASSERT(expr) _ASSERT(expr, "%s", #expr) -#define ASSERT_EQUAL(expected, actual) _ASSERT((expected) == (actual), "%s == %s", #expected, #actual); +/* This macro is meant for int-like things that can print with %d */ +#define ASSERT_EQUAL(expected, actual) _ASSERT((expected) == (actual), \ + "%s == %s (expected %d, was %d)", \ + #actual, #expected, expected, actual); struct TestDescription { char *name;