X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fhashkit_functions.c;h=23feb9e50a6f3e46459684fb0a9196d07081359a;hb=28adf7b936c6f5c25b7526ff56ec1256da1246d4;hp=d1f846e74f324c2326e8380348fe582533e68d07;hpb=4209d822c35fea2ca1c5879e18bc6c063dba4c41;p=m6w6%2Flibmemcached diff --git a/tests/hashkit_functions.c b/tests/hashkit_functions.c index d1f846e7..23feb9e5 100644 --- a/tests/hashkit_functions.c +++ b/tests/hashkit_functions.c @@ -15,7 +15,7 @@ #include -#include "test.h" +#include #include "hash_results.h" @@ -31,10 +31,11 @@ struct hash_test_st bool _unused; }; -static test_return_t init_test(void *not_used __attribute__((unused))) +static test_return_t init_test(void *not_used) { hashkit_st hashk; hashkit_st *hashk_ptr; + (void)not_used; hashk_ptr= hashkit_create(&hashk); test_true(hashk_ptr); @@ -46,9 +47,10 @@ static test_return_t init_test(void *not_used __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t allocation_test(void *not_used __attribute__((unused))) +static test_return_t allocation_test(void *not_used) { hashkit_st *hashk_ptr; + (void)not_used; hashk_ptr= hashkit_create(NULL); test_true(hashk_ptr); @@ -115,10 +117,11 @@ static test_return_t clone_test(hashkit_st *hashk) return TEST_SUCCESS; } -static test_return_t one_at_a_time_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t one_at_a_time_run (hashkit_st *hashk) { uint32_t x; const char **ptr; + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -131,10 +134,11 @@ static test_return_t one_at_a_time_run (hashkit_st *hashk __attribute__((unused) return TEST_SUCCESS; } -static test_return_t md5_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t md5_run (hashkit_st *hashk) { uint32_t x; const char **ptr; + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -147,10 +151,11 @@ static test_return_t md5_run (hashkit_st *hashk __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t crc_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t crc_run (hashkit_st *hashk) { uint32_t x; const char **ptr; + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -163,10 +168,11 @@ static test_return_t crc_run (hashkit_st *hashk __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t fnv1_64_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t fnv1_64_run (hashkit_st *hashk) { uint32_t x; const char **ptr; + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -179,10 +185,11 @@ static test_return_t fnv1_64_run (hashkit_st *hashk __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t fnv1a_64_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t fnv1a_64_run (hashkit_st *hashk) { uint32_t x; const char **ptr; + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -195,11 +202,11 @@ static test_return_t fnv1a_64_run (hashkit_st *hashk __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t fnv1_32_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t fnv1_32_run (hashkit_st *hashk) { uint32_t x; const char **ptr; - + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -212,10 +219,11 @@ static test_return_t fnv1_32_run (hashkit_st *hashk __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t fnv1a_32_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t fnv1a_32_run (hashkit_st *hashk) { uint32_t x; const char **ptr; + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -228,10 +236,11 @@ static test_return_t fnv1a_32_run (hashkit_st *hashk __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t hsieh_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t hsieh_run (hashkit_st *hashk) { uint32_t x; const char **ptr; + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -248,8 +257,10 @@ static test_return_t hsieh_run (hashkit_st *hashk __attribute__((unused))) return TEST_SUCCESS; } -static test_return_t murmur_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t murmur_run (hashkit_st *hashk) { + (void)hashk; + #ifdef WORDS_BIGENDIAN (void)murmur_values; return TEST_SKIPPED; @@ -273,11 +284,11 @@ static test_return_t murmur_run (hashkit_st *hashk __attribute__((unused))) #endif } -static test_return_t jenkins_run (hashkit_st *hashk __attribute__((unused))) +static test_return_t jenkins_run (hashkit_st *hashk) { uint32_t x; const char **ptr; - + (void)hashk; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { @@ -314,7 +325,7 @@ static test_return_t hashkit_digest_test(hashkit_st *hashk) static test_return_t hashkit_set_function_test(hashkit_st *hashk) { - for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) + for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) { hashkit_return_t rc; uint32_t x; @@ -334,10 +345,10 @@ static test_return_t hashkit_set_function_test(hashkit_st *hashk) continue; #endif - if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_CUSTOM) + if (rc == HASHKIT_INVALID_ARGUMENT && algo == HASHKIT_HASH_CUSTOM) continue; - test_true(rc == HASHKIT_SUCCESS); + test_true_got(rc == HASHKIT_SUCCESS, hashkit_strerror(NULL, rc)); switch (algo) { @@ -427,7 +438,7 @@ static test_return_t hashkit_set_custom_function_test(hashkit_st *hashk) static test_return_t hashkit_set_distribution_function_test(hashkit_st *hashk) { - for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) + for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) { hashkit_return_t rc; @@ -437,7 +448,7 @@ static test_return_t hashkit_set_distribution_function_test(hashkit_st *hashk) if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_HSIEH) continue; - if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_CUSTOM) + if (rc == HASHKIT_INVALID_ARGUMENT && algo == HASHKIT_HASH_CUSTOM) continue; test_true(rc == HASHKIT_SUCCESS); @@ -459,7 +470,7 @@ static test_return_t hashkit_set_custom_distribution_function_test(hashkit_st *h static test_return_t hashkit_get_function_test(hashkit_st *hashk) { - for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) + for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) { hashkit_return_t rc;