diff options
Diffstat (limited to 'test/tests.c')
-rw-r--r-- | test/tests.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/tests.c b/test/tests.c index 9ef88f4a8d..d8df43f319 100644 --- a/test/tests.c +++ b/test/tests.c @@ -12,6 +12,7 @@ static const struct unittest *unittests[] = { &test_paths, &test_repack_sws, #if HAVE_ZIMG + &test_repack, // zimg only due to cross-checking with zimg.c &test_repack_zimg, #endif NULL @@ -128,3 +129,25 @@ void assert_text_files_equal_impl(const char *file, int line, abort(); } } + +static void hexdump(const uint8_t *d, size_t size) +{ + printf("|"); + while (size--) { + printf(" %02x", d[0]); + d++; + } + printf(" |\n"); +} + +void assert_memcmp_impl(const char *file, int line, + const void *a, const void *b, size_t size) +{ + if (memcmp(a, b, size) == 0) + return; + + printf("%s:%d: mismatching data:\n", file, line); + hexdump(a, size); + hexdump(b, size); + abort(); +} |