From 9ee259d9a29d83d79d912d1716b4044c63e90343 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 25 Oct 2013 22:24:28 -0700 Subject: [PATCH] Print more informative assert message ASSERT_EQUAL() is for int-like types that will print with %d. --- tests/unit/glkunit.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.30.2