diff options
Diffstat (limited to 'tests/test_common.c')
-rw-r--r-- | tests/test_common.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/test_common.c b/tests/test_common.c index 2fa445f6..3804245e 100644 --- a/tests/test_common.c +++ b/tests/test_common.c @@ -24,7 +24,8 @@ int TEST_EQ(int result, int expected_result, const char* testname) { return 1; } else { fprintf(stderr, "%s Test " COL_RED "FAILED\n" COL_STOP, testname); - fprintf(stderr, " Expected: %d, got: %d\n", expected_result, result); + fprintf(stderr, " Expected: 0x%x (%d), got: 0x%x (%d)\n", + expected_result, expected_result, result, result); gTestSuccess = 0; return 0; } @@ -36,7 +37,8 @@ int TEST_NEQ(int result, int not_expected_result, const char* testname) { return 1; } else { fprintf(stderr, "%s Test " COL_RED "FAILED\n" COL_STOP, testname); - fprintf(stderr, " Didn't expect %d, but got it.\n", not_expected_result); + fprintf(stderr, " Didn't expect 0x%x (%d), but got it.\n", + not_expected_result, not_expected_result); gTestSuccess = 0; return 0; } @@ -91,6 +93,17 @@ int TEST_STR_EQ(const char* result, const char* expected_result, } +int TEST_SUCC(int result, const char* testname) { + if (result == 0) { + fprintf(stderr, "%s Test " COL_GREEN "PASSED\n" COL_STOP, testname); + } else { + fprintf(stderr, "%s Test " COL_RED "FAILED\n" COL_STOP, testname); + fprintf(stderr, " Expected SUCCESS, got: 0x%lx\n", (long)result); + gTestSuccess = 0; + } + return !result; +} + int TEST_TRUE(int result, const char* testname) { if (result) { fprintf(stderr, "%s Test " COL_GREEN "PASSED\n" COL_STOP, testname); |