#include "test.h"
/* The fail macros mark the current test step as failed, and continue */
-#define fail_if(expr, msg) \
- do { \
- if(expr) { \
- fprintf(stderr, "%s:%d Assertion '%s' met: %s\n", \
- __FILE__, __LINE__, #expr, msg); \
- unitfail++; \
- } \
+#define fail_if(expr, msg) \
+ do { \
+ if(expr) { \
+ fprintf(stderr, "%s:%d FAILED Assertion '%s' met: %s\n", \
+ __FILE__, __LINE__, #expr, msg); \
+ unitfail++; \
+ } \
} while(0)
#define fail_unless(expr, msg) \
do { \
if(!(expr)) { \
- fprintf(stderr, "%s:%d Assertion '%s' failed: %s\n", \
+ fprintf(stderr, "%s:%d Assertion '%s' FAILED: %s\n", \
__FILE__, __LINE__, #expr, msg); \
unitfail++; \
} \
#define verify_memory(dynamic, check, len) \
do { \
- if(dynamic && memcmp(dynamic, check, len)) { \
- fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \
- __FILE__, __LINE__, len, \
+ if(dynamic && memcmp(dynamic, check, len)) { \
+ fprintf(stderr, "%s:%d Memory buffer FAILED match size %d. " \
+ "'%s' is not\n", __FILE__, __LINE__, len, \
hexdump((const unsigned char *)check, len)); \
fprintf(stderr, "%s:%d the same as '%s'\n", __FILE__, __LINE__, \
hexdump((const unsigned char *)dynamic, len)); \
/* fail() is for when the test case figured out by itself that a check
proved a failure */
#define fail(msg) do { \
- fprintf(stderr, "%s:%d test failed: '%s'\n", \
+ fprintf(stderr, "%s:%d test FAILED: '%s'\n", \
__FILE__, __LINE__, msg); \
unitfail++; \
} while(0)
#define abort_if(expr, msg) \
do { \
if(expr) { \
- fprintf(stderr, "%s:%d Abort assertion '%s' met: %s\n", \
+ fprintf(stderr, "%s:%d ABORT assertion '%s' met: %s\n", \
__FILE__, __LINE__, #expr, msg); \
unitfail++; \
goto unit_test_abort; \
#define abort_unless(expr, msg) \
do { \
if(!(expr)) { \
- fprintf(stderr, "%s:%d Abort assertion '%s' failed: %s\n", \
+ fprintf(stderr, "%s:%d ABORT assertion '%s' failed: %s\n", \
__FILE__, __LINE__, #expr, msg); \
unitfail++; \
goto unit_test_abort; \
#define abort_test(msg) \
do { \
- fprintf(stderr, "%s:%d test aborted: '%s'\n", \
+ fprintf(stderr, "%s:%d test ABORTED: '%s'\n", \
__FILE__, __LINE__, msg); \
unitfail++; \
goto unit_test_abort; \
{ \
(void)arg; \
if(unit_setup()) { \
- fail("unit_setup() failure"); \
+ fail("unit_setup() FAILURE"); \
} \
else {