aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/common.h b/common.h
index 18d817c..c784f1b 100644
--- a/common.h
+++ b/common.h
@@ -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 {\