diff options
Diffstat (limited to '')
-rw-r--r-- | common.h | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -109,7 +109,8 @@ escape(const char *s, size_t n) static int run_tests(const char *name, enum libhashsum_algorithm algorithm, size_t hash_size, - struct testcase *testcases, size_t ntestcases, char hexsum[]) + struct testcase *testcases, size_t ntestcases, char hexsum[], + unsigned char supports_non_whole_bytes) { struct libhashsum_hasher hasher, hasher2; unsigned char custom_hashbuffer[2048]; @@ -161,6 +162,10 @@ run_tests(const char *name, enum libhashsum_algorithm algorithm, size_t hash_siz fprintf(stderr, "libhashsum_init_hasher returned non-NULL pointer in .stretch\n"); return 2; } + if (hasher.supports_non_whole_bytes != supports_non_whole_bytes) { + fprintf(stderr, "libhashsum_init_hasher returned unexpected value in .supports_non_whole_bytes\n"); + return 2; + } input_string_len = strlen(testcases[i].input); bits = testcases[i].extra_bits; if (bits) { @@ -260,10 +265,11 @@ run_tests(const char *name, enum libhashsum_algorithm algorithm, size_t hash_siz return !ok; } -# define TEST_MAIN(NAME, ID)\ +# define TEST_MAIN(NAME, ID, SUPPORTS_NON_WHOLE_BYTES)\ char hexsum[LIBHASHSUM_##ID##_HASH_SIZE * 2 + 1];\ return run_tests(NAME, LIBHASHSUM_##ID, LIBHASHSUM_##ID##_HASH_SIZE,\ - testcases, sizeof(testcases) / sizeof(*testcases), hexsum) + testcases, sizeof(testcases) / sizeof(*testcases), hexsum,\ + (SUPPORTS_NON_WHOLE_BYTES)) # define ASSERT(ASSERTION)\ do {\ |