Reduce the size of hashmap_nodes.h file

Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.
This commit is contained in:
Ondřej Surý 2024-08-15 10:02:14 +02:00
parent 43c81e2e24
commit 2310c322c0
No known key found for this signature in database
GPG key ID: 2820F37E873DEA41
2 changed files with 1278 additions and 7615 deletions

File diff suppressed because it is too large Load diff

View file

@ -233,17 +233,15 @@ test_hashmap_iterator(bool random_data) {
isc_hashmap_create(mctx, HASHMAP_MIN_BITS, &hashmap);
assert_non_null(hashmap);
if (random_data) {
for (size_t i = 0; i < count; i++) {
/* short keys */
snprintf((char *)nodes[i].key, 16, "%u",
(unsigned int)i);
strlcat((char *)nodes[i].key, " key of a raw hashmap!!",
16);
for (size_t i = 0; i < count; i++) {
/* short keys */
snprintf((char *)nodes[i].key, 16, "%u", (unsigned int)i);
strlcat((char *)nodes[i].key, " key of a raw hashmap!!", 16);
if (random_data) {
nodes[i].hashval = isc_hash32(nodes[i].key, 16, true);
} else {
nodes[i].hashval = test_hashvals[i];
}
} else {
memmove(nodes, test_nodes, sizeof(test_nodes));
}
for (size_t i = 0; i < count; i++) {