mirror of
https://github.com/curl/curl.git
synced 2025-01-18 14:04:30 +08:00
unit1603: Demote hash mismatch failure to a warning
The hashes can vary between architectures (e.g. Sparc differs from x86_64). This is not a fatal problem but just reduces the coverage of these white-box tests, as the assumptions about into which hash bucket each key falls are no longer valid.
This commit is contained in:
parent
d7e352402c
commit
eb3703f052
@ -57,16 +57,15 @@ UNITTEST_START
|
|||||||
char *nodep;
|
char *nodep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Ensure the key1 hashes are as expected in order to test both hash
|
/* Ensure the key hashes are as expected in order to test both hash
|
||||||
collisions and a full table */
|
collisions and a full table. Unfortunately, the hashes can vary
|
||||||
fail_unless(Curl_hash_str(key1, strlen(key1), slots) == 1,
|
between architectures. */
|
||||||
"hashes are not computed as expected");
|
if(Curl_hash_str(key1, strlen(key1), slots) != 1 ||
|
||||||
fail_unless(Curl_hash_str(key2, strlen(key2), slots) == 0,
|
Curl_hash_str(key2, strlen(key2), slots) != 0 ||
|
||||||
"hashes are not computed as expected");
|
Curl_hash_str(key3, strlen(key3), slots) != 2 ||
|
||||||
fail_unless(Curl_hash_str(key3, strlen(key3), slots) == 2,
|
Curl_hash_str(key4, strlen(key4), slots) != 1)
|
||||||
"hashes are not computed as expected");
|
fprintf(stderr, "Warning: hashes are not computed as expected on this "
|
||||||
fail_unless(Curl_hash_str(key4, strlen(key4), slots) == 1,
|
"architecture; test coverage will be less comprehensive\n");
|
||||||
"hashes are not computed as expected");
|
|
||||||
|
|
||||||
nodep = Curl_hash_add(&hash_static, &key1, strlen(key1), &key1);
|
nodep = Curl_hash_add(&hash_static, &key1, strlen(key1), &key1);
|
||||||
fail_unless(nodep, "insertion into hash failed");
|
fail_unless(nodep, "insertion into hash failed");
|
||||||
|
Loading…
Reference in New Issue
Block a user