I want to extend minunit to be more useful, with the macro.
#define mu_assert_equal(actual, expected) do { \
if (actual != expected) { \
char *message = malloc(MAX_ERROR_MESSAGE_LENGTH); \
if (message == NULL) { printf("malloc failed"); exit(1); } \
snprintf(message, MAX_ERROR_MESSAGE_LENGTH, "required: %s != %s, reality: %s == %lu", \
#actual, #expected, #actual, actual); \
return message; \
} \
} while (0)
invoked with:
mu_assert_equal(bytes_parsed, 1);
but the macro above only works for unsigned long values.
How I can I find the type of the macro arguments, and more importantly, their printf specifiers.