11de3decc9357714498f96e13f1c1c2da1046811 |
|
06-Oct-2015 |
Michal Schmidt <mschmidt@redhat.com> |
test: hashmap - increase number of entries for crippled hash test
The purpose of testing with the crippled hash function is to cover
the otherwise very unlikely codepath in bucket_calculate_dib() where
it has to fall back to recomputing the hash value.
This unlikely path was not covered by test-hashmap anymore after
57217c8f "test: hashmap - cripple the hash function by truncating the
input rather than the output".
Restore the test coverage by increasing the number of entries in the test.
The number was determined empirically by checking with lcov. |
57217c8f2a2dea07b41ecf05000172ce77a90466 |
|
05-Oct-2015 |
Tom Gundersen <teg@jklm.no> |
test: hashmap - cripple the hash function by truncating the input rather than the output
The reason for the crippled hash function is to reduce the distribution
of the hash function, do this by truncating the domain rather than the
range. This does introduce a change in behavoir as the range is no longer
contiguous, which greatly reduces collisions.
This is needed as a follow-up patch will no longer allow individual hash
functions to alter the output directly. |
8927b1dad2d4a7330174cb924090b4635a2547fb |
|
14-Jun-2015 |
David Herrmann <dh.herrmann@gmail.com> |
hashmap: fix iterators to not skip entries
Currently, the HASHMAP iterators stop at the first NULL entry in a
hashmap. This is non-obvious and breaks users like sd-device, which
legitimately store NULL values in a hashmap.
Fix all the iterators by taking a pointer to the value storage, instead of
returning it. The iterators now return a boolean that tells whether the
end of the list was reached.
Current users of HASHMAP_FOREACH() are *NOT* changed to explicitly check
for NULL. If it turns out, there were users that inserted NULL into
hashmaps, but didn't properly check for it during iteration, then we
really want to find those and fix them. |
32a4456cc252689f51f383d150d34ed636bfec4d |
|
23-Oct-2014 |
Michal Schmidt <mschmidt@redhat.com> |
test: generate tests for OrderedHashmap from Hashmap tests
test-hashmap-ordered.c is generated from test-hashmap-plain.c simply by
substituting "ordered_hashmap" for "hashmap" etc.
In the cases where tests rely on the order of entries, a distinction
between plain and ordered hashmaps is made using the ORDERED macro,
which is defined only for test-hashmap-ordered.c. |