1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd
5 Copyright 2013 Daniel Buch
8 #include "alloc-util.h"
12 #include "string-util.h"
16 static bool arg_slow = false;
18 void test_hashmap_funcs(void);
20 static void test_hashmap_replace(void) {
22 char *val1, *val2, *val3, *val4, *val5, *r;
24 log_info("%s", __func__);
26 m = hashmap_new(&string_hash_ops);
28 val1 = strdup("val1");
30 val2 = strdup("val2");
32 val3 = strdup("val3");
34 val4 = strdup("val4");
36 val5 = strdup("val5");
39 hashmap_put(m, "key 1", val1);
40 hashmap_put(m, "key 2", val2);
41 hashmap_put(m, "key 3", val3);
42 hashmap_put(m, "key 4", val4);
44 hashmap_replace(m, "key 3", val1);
45 r = hashmap_get(m, "key 3");
46 assert_se(streq(r, "val1"));
48 hashmap_replace(m, "key 5", val5);
49 r = hashmap_get(m, "key 5");
50 assert_se(streq(r, "val5"));
60 static void test_hashmap_copy(void) {
62 char *val1, *val2, *val3, *val4, *r;
64 log_info("%s", __func__);
66 val1 = strdup("val1");
68 val2 = strdup("val2");
70 val3 = strdup("val3");
72 val4 = strdup("val4");
75 m = hashmap_new(&string_hash_ops);
77 hashmap_put(m, "key 1", val1);
78 hashmap_put(m, "key 2", val2);
79 hashmap_put(m, "key 3", val3);
80 hashmap_put(m, "key 4", val4);
82 copy = hashmap_copy(m);
84 r = hashmap_get(copy, "key 1");
85 assert_se(streq(r, "val1"));
86 r = hashmap_get(copy, "key 2");
87 assert_se(streq(r, "val2"));
88 r = hashmap_get(copy, "key 3");
89 assert_se(streq(r, "val3"));
90 r = hashmap_get(copy, "key 4");
91 assert_se(streq(r, "val4"));
93 hashmap_free_free(copy);
97 static void test_hashmap_get_strv(void) {
100 char *val1, *val2, *val3, *val4;
102 log_info("%s", __func__);
104 val1 = strdup("val1");
106 val2 = strdup("val2");
108 val3 = strdup("val3");
110 val4 = strdup("val4");
113 m = hashmap_new(&string_hash_ops);
115 hashmap_put(m, "key 1", val1);
116 hashmap_put(m, "key 2", val2);
117 hashmap_put(m, "key 3", val3);
118 hashmap_put(m, "key 4", val4);
120 strv = hashmap_get_strv(m);
123 strv = strv_sort(strv);
126 assert_se(streq(strv[0], "val1"));
127 assert_se(streq(strv[1], "val2"));
128 assert_se(streq(strv[2], "val3"));
129 assert_se(streq(strv[3], "val4"));
136 static void test_hashmap_move_one(void) {
138 char *val1, *val2, *val3, *val4, *r;
140 log_info("%s", __func__);
142 val1 = strdup("val1");
144 val2 = strdup("val2");
146 val3 = strdup("val3");
148 val4 = strdup("val4");
151 m = hashmap_new(&string_hash_ops);
152 n = hashmap_new(&string_hash_ops);
154 hashmap_put(m, "key 1", val1);
155 hashmap_put(m, "key 2", val2);
156 hashmap_put(m, "key 3", val3);
157 hashmap_put(m, "key 4", val4);
159 assert_se(hashmap_move_one(n, NULL, "key 3") == -ENOENT);
160 assert_se(hashmap_move_one(n, m, "key 5") == -ENOENT);
161 assert_se(hashmap_move_one(n, m, "key 3") == 0);
162 assert_se(hashmap_move_one(n, m, "key 4") == 0);
164 r = hashmap_get(n, "key 3");
165 assert_se(r && streq(r, "val3"));
166 r = hashmap_get(n, "key 4");
167 assert_se(r && streq(r, "val4"));
168 r = hashmap_get(m, "key 3");
171 assert_se(hashmap_move_one(n, m, "key 3") == -EEXIST);
173 hashmap_free_free(m);
174 hashmap_free_free(n);
177 static void test_hashmap_move(void) {
179 char *val1, *val2, *val3, *val4, *r;
181 log_info("%s", __func__);
183 val1 = strdup("val1");
185 val2 = strdup("val2");
187 val3 = strdup("val3");
189 val4 = strdup("val4");
192 m = hashmap_new(&string_hash_ops);
193 n = hashmap_new(&string_hash_ops);
195 hashmap_put(n, "key 1", strdup(val1));
196 hashmap_put(m, "key 1", val1);
197 hashmap_put(m, "key 2", val2);
198 hashmap_put(m, "key 3", val3);
199 hashmap_put(m, "key 4", val4);
201 assert_se(hashmap_move(n, NULL) == 0);
202 assert_se(hashmap_move(n, m) == 0);
204 assert_se(hashmap_size(m) == 1);
205 r = hashmap_get(m, "key 1");
206 assert_se(r && streq(r, "val1"));
208 r = hashmap_get(n, "key 1");
209 assert_se(r && streq(r, "val1"));
210 r = hashmap_get(n, "key 2");
211 assert_se(r && streq(r, "val2"));
212 r = hashmap_get(n, "key 3");
213 assert_se(r && streq(r, "val3"));
214 r = hashmap_get(n, "key 4");
215 assert_se(r && streq(r, "val4"));
217 hashmap_free_free(m);
218 hashmap_free_free(n);
221 static void test_hashmap_update(void) {
223 char *val1, *val2, *r;
225 log_info("%s", __func__);
227 m = hashmap_new(&string_hash_ops);
228 val1 = strdup("old_value");
230 val2 = strdup("new_value");
233 hashmap_put(m, "key 1", val1);
234 r = hashmap_get(m, "key 1");
235 assert_se(streq(r, "old_value"));
237 assert_se(hashmap_update(m, "key 2", val2) == -ENOENT);
238 r = hashmap_get(m, "key 1");
239 assert_se(streq(r, "old_value"));
241 assert_se(hashmap_update(m, "key 1", val2) == 0);
242 r = hashmap_get(m, "key 1");
243 assert_se(streq(r, "new_value"));
250 static void test_hashmap_put(void) {
252 int valid_hashmap_put;
253 void *val1 = (void*) "val 1";
254 void *val2 = (void*) "val 2";
255 _cleanup_free_ char* key1 = NULL;
257 log_info("%s", __func__);
259 assert_se(hashmap_ensure_allocated(&m, &string_hash_ops) >= 0);
262 valid_hashmap_put = hashmap_put(m, "key 1", val1);
263 assert_se(valid_hashmap_put == 1);
264 assert_se(hashmap_put(m, "key 1", val1) == 0);
265 assert_se(hashmap_put(m, "key 1", val2) == -EEXIST);
266 key1 = strdup("key 1");
267 assert_se(hashmap_put(m, key1, val1) == 0);
268 assert_se(hashmap_put(m, key1, val2) == -EEXIST);
273 static void test_hashmap_remove(void) {
274 _cleanup_hashmap_free_ Hashmap *m = NULL;
277 log_info("%s", __func__);
279 r = hashmap_remove(NULL, "key 1");
280 assert_se(r == NULL);
282 m = hashmap_new(&string_hash_ops);
285 r = hashmap_remove(m, "no such key");
286 assert_se(r == NULL);
288 hashmap_put(m, "key 1", (void*) "val 1");
289 hashmap_put(m, "key 2", (void*) "val 2");
291 r = hashmap_remove(m, "key 1");
292 assert_se(streq(r, "val 1"));
294 r = hashmap_get(m, "key 2");
295 assert_se(streq(r, "val 2"));
296 assert_se(!hashmap_get(m, "key 1"));
299 static void test_hashmap_remove2(void) {
300 _cleanup_hashmap_free_free_free_ Hashmap *m = NULL;
301 char key1[] = "key 1";
302 char key2[] = "key 2";
303 char val1[] = "val 1";
304 char val2[] = "val 2";
307 log_info("%s", __func__);
309 r = hashmap_remove2(NULL, "key 1", &r2);
310 assert_se(r == NULL);
312 m = hashmap_new(&string_hash_ops);
315 r = hashmap_remove2(m, "no such key", &r2);
316 assert_se(r == NULL);
318 hashmap_put(m, strdup(key1), strdup(val1));
319 hashmap_put(m, strdup(key2), strdup(val2));
321 r = hashmap_remove2(m, key1, &r2);
322 assert_se(streq(r, val1));
323 assert_se(streq(r2, key1));
327 r = hashmap_get(m, key2);
328 assert_se(streq(r, val2));
329 assert_se(!hashmap_get(m, key1));
332 static void test_hashmap_remove_value(void) {
333 _cleanup_hashmap_free_ Hashmap *m = NULL;
336 char val1[] = "val 1";
337 char val2[] = "val 2";
339 log_info("%s", __func__);
341 r = hashmap_remove_value(NULL, "key 1", val1);
342 assert_se(r == NULL);
344 m = hashmap_new(&string_hash_ops);
347 r = hashmap_remove_value(m, "key 1", val1);
348 assert_se(r == NULL);
350 hashmap_put(m, "key 1", val1);
351 hashmap_put(m, "key 2", val2);
353 r = hashmap_remove_value(m, "key 1", val1);
354 assert_se(streq(r, "val 1"));
356 r = hashmap_get(m, "key 2");
357 assert_se(streq(r, "val 2"));
358 assert_se(!hashmap_get(m, "key 1"));
360 r = hashmap_remove_value(m, "key 2", val1);
361 assert_se(r == NULL);
363 r = hashmap_get(m, "key 2");
364 assert_se(streq(r, "val 2"));
365 assert_se(!hashmap_get(m, "key 1"));
368 static void test_hashmap_remove_and_put(void) {
369 _cleanup_hashmap_free_ Hashmap *m = NULL;
373 log_info("%s", __func__);
375 m = hashmap_new(&string_hash_ops);
378 valid = hashmap_remove_and_put(m, "invalid key", "new key", NULL);
379 assert_se(valid == -ENOENT);
381 valid = hashmap_put(m, "key 1", (void*) (const char *) "val 1");
382 assert_se(valid == 1);
384 valid = hashmap_remove_and_put(NULL, "key 1", "key 2", (void*) (const char *) "val 2");
385 assert_se(valid == -ENOENT);
387 valid = hashmap_remove_and_put(m, "key 1", "key 2", (void*) (const char *) "val 2");
388 assert_se(valid == 0);
390 r = hashmap_get(m, "key 2");
391 assert_se(streq(r, "val 2"));
392 assert_se(!hashmap_get(m, "key 1"));
394 valid = hashmap_put(m, "key 3", (void*) (const char *) "val 3");
395 assert_se(valid == 1);
396 valid = hashmap_remove_and_put(m, "key 3", "key 2", (void*) (const char *) "val 2");
397 assert_se(valid == -EEXIST);
400 static void test_hashmap_remove_and_replace(void) {
401 _cleanup_hashmap_free_ Hashmap *m = NULL;
403 void *key1 = UINT_TO_PTR(1);
404 void *key2 = UINT_TO_PTR(2);
405 void *key3 = UINT_TO_PTR(3);
409 log_info("%s", __func__);
411 m = hashmap_new(&trivial_hash_ops);
414 valid = hashmap_remove_and_replace(m, key1, key2, NULL);
415 assert_se(valid == -ENOENT);
417 valid = hashmap_put(m, key1, key1);
418 assert_se(valid == 1);
420 valid = hashmap_remove_and_replace(NULL, key1, key2, key2);
421 assert_se(valid == -ENOENT);
423 valid = hashmap_remove_and_replace(m, key1, key2, key2);
424 assert_se(valid == 0);
426 r = hashmap_get(m, key2);
427 assert_se(r == key2);
428 assert_se(!hashmap_get(m, key1));
430 valid = hashmap_put(m, key3, key3);
431 assert_se(valid == 1);
432 valid = hashmap_remove_and_replace(m, key3, key2, key2);
433 assert_se(valid == 0);
434 r = hashmap_get(m, key2);
435 assert_se(r == key2);
436 assert_se(!hashmap_get(m, key3));
438 /* Repeat this test several times to increase the chance of hitting
439 * the less likely case in hashmap_remove_and_replace where it
440 * compensates for the backward shift. */
441 for (i = 0; i < 20; i++) {
444 for (j = 1; j < 7; j++)
445 hashmap_put(m, UINT_TO_PTR(10*i + j), UINT_TO_PTR(10*i + j));
446 valid = hashmap_remove_and_replace(m, UINT_TO_PTR(10*i + 1),
447 UINT_TO_PTR(10*i + 2),
448 UINT_TO_PTR(10*i + 2));
449 assert_se(valid == 0);
450 assert_se(!hashmap_get(m, UINT_TO_PTR(10*i + 1)));
451 for (j = 2; j < 7; j++) {
452 r = hashmap_get(m, UINT_TO_PTR(10*i + j));
453 assert_se(r == UINT_TO_PTR(10*i + j));
458 static void test_hashmap_ensure_allocated(void) {
462 log_info("%s", __func__);
464 m = hashmap_new(&string_hash_ops);
466 valid_hashmap = hashmap_ensure_allocated(&m, &string_hash_ops);
467 assert_se(valid_hashmap == 0);
473 static void test_hashmap_foreach_key(void) {
476 bool key_found[] = { false, false, false, false };
479 static const char key_table[] =
485 log_info("%s", __func__);
487 m = hashmap_new(&string_hash_ops);
489 NULSTR_FOREACH(key, key_table)
490 hashmap_put(m, key, (void*) (const char*) "my dummy val");
492 HASHMAP_FOREACH_KEY(s, key, m, i) {
494 if (!key_found[0] && streq(key, "key 1"))
496 else if (!key_found[1] && streq(key, "key 2"))
498 else if (!key_found[2] && streq(key, "key 3"))
500 else if (!key_found[3] && streq(key, "fail"))
505 assert_se(key_found[0] && key_found[1] && key_found[2] && !key_found[3]);
510 static void test_hashmap_foreach(void) {
513 bool value_found[] = { false, false, false, false };
514 char *val1, *val2, *val3, *val4, *s;
517 log_info("%s", __func__);
519 val1 = strdup("my val1");
521 val2 = strdup("my val2");
523 val3 = strdup("my val3");
525 val4 = strdup("my val4");
531 HASHMAP_FOREACH(s, m, i)
533 assert_se(count == 0);
535 m = hashmap_new(&string_hash_ops);
538 HASHMAP_FOREACH(s, m, i)
540 assert_se(count == 0);
542 hashmap_put(m, "Key 1", val1);
543 hashmap_put(m, "Key 2", val2);
544 hashmap_put(m, "Key 3", val3);
545 hashmap_put(m, "Key 4", val4);
547 HASHMAP_FOREACH(s, m, i) {
548 if (!value_found[0] && streq(s, val1))
549 value_found[0] = true;
550 else if (!value_found[1] && streq(s, val2))
551 value_found[1] = true;
552 else if (!value_found[2] && streq(s, val3))
553 value_found[2] = true;
554 else if (!value_found[3] && streq(s, val4))
555 value_found[3] = true;
559 assert_se(value_found[0] && value_found[1] && value_found[2] && value_found[3]);
561 hashmap_free_free(m);
564 static void test_hashmap_merge(void) {
567 char *val1, *val2, *val3, *val4, *r;
569 log_info("%s", __func__);
571 val1 = strdup("my val1");
573 val2 = strdup("my val2");
575 val3 = strdup("my val3");
577 val4 = strdup("my val4");
580 n = hashmap_new(&string_hash_ops);
581 m = hashmap_new(&string_hash_ops);
583 hashmap_put(m, "Key 1", val1);
584 hashmap_put(m, "Key 2", val2);
585 hashmap_put(n, "Key 3", val3);
586 hashmap_put(n, "Key 4", val4);
588 assert_se(hashmap_merge(m, n) == 0);
589 r = hashmap_get(m, "Key 3");
590 assert_se(r && streq(r, "my val3"));
591 r = hashmap_get(m, "Key 4");
592 assert_se(r && streq(r, "my val4"));
597 hashmap_free_free(m);
600 static void test_hashmap_contains(void) {
604 log_info("%s", __func__);
606 val1 = strdup("my val");
609 m = hashmap_new(&string_hash_ops);
611 assert_se(!hashmap_contains(m, "Key 1"));
612 hashmap_put(m, "Key 1", val1);
613 assert_se(hashmap_contains(m, "Key 1"));
614 assert_se(!hashmap_contains(m, "Key 2"));
616 assert_se(!hashmap_contains(NULL, "Key 1"));
619 hashmap_free_free(m);
622 static void test_hashmap_isempty(void) {
626 log_info("%s", __func__);
628 val1 = strdup("my val");
631 m = hashmap_new(&string_hash_ops);
633 assert_se(hashmap_isempty(m));
634 hashmap_put(m, "Key 1", val1);
635 assert_se(!hashmap_isempty(m));
638 hashmap_free_free(m);
641 static void test_hashmap_size(void) {
643 char *val1, *val2, *val3, *val4;
645 log_info("%s", __func__);
647 val1 = strdup("my val");
649 val2 = strdup("my val");
651 val3 = strdup("my val");
653 val4 = strdup("my val");
656 assert_se(hashmap_size(NULL) == 0);
657 assert_se(hashmap_buckets(NULL) == 0);
659 m = hashmap_new(&string_hash_ops);
661 hashmap_put(m, "Key 1", val1);
662 hashmap_put(m, "Key 2", val2);
663 hashmap_put(m, "Key 3", val3);
664 hashmap_put(m, "Key 4", val4);
667 assert_se(hashmap_size(m) == 4);
668 assert_se(hashmap_buckets(m) >= 4);
669 hashmap_free_free(m);
672 static void test_hashmap_get(void) {
677 log_info("%s", __func__);
679 val = strdup("my val");
682 r = hashmap_get(NULL, "Key 1");
683 assert_se(r == NULL);
685 m = hashmap_new(&string_hash_ops);
687 hashmap_put(m, "Key 1", val);
689 r = hashmap_get(m, "Key 1");
690 assert_se(streq(r, val));
692 r = hashmap_get(m, "no such key");
693 assert_se(r == NULL);
696 hashmap_free_free(m);
699 static void test_hashmap_get2(void) {
703 char key_orig[] = "Key 1";
706 log_info("%s", __func__);
708 val = strdup("my val");
711 key_copy = strdup(key_orig);
714 r = hashmap_get2(NULL, key_orig, &key_copy);
715 assert_se(r == NULL);
717 m = hashmap_new(&string_hash_ops);
719 hashmap_put(m, key_copy, val);
722 r = hashmap_get2(m, key_orig, &key_copy);
723 assert_se(streq(r, val));
724 assert_se(key_orig != key_copy);
725 assert_se(streq(key_orig, key_copy));
727 r = hashmap_get2(m, "no such key", NULL);
728 assert_se(r == NULL);
731 hashmap_free_free_free(m);
734 static void crippled_hashmap_func(const void *p, struct siphash *state) {
735 return trivial_hash_func(INT_TO_PTR(PTR_TO_INT(p) & 0xff), state);
738 static const struct hash_ops crippled_hashmap_ops = {
739 .hash = crippled_hashmap_func,
740 .compare = trivial_compare_func,
743 static void test_hashmap_many(void) {
748 const struct hash_ops *ops;
751 { .ops = NULL, .n_entries = arg_slow ? 1 << 20 : 240 },
752 { .ops = &crippled_hashmap_ops, .n_entries = arg_slow ? 1 << 14 : 140 },
755 log_info("%s (%s)", __func__, arg_slow ? "slow" : "fast");
757 for (j = 0; j < ELEMENTSOF(tests); j++) {
758 assert_se(h = hashmap_new(tests[j].ops));
760 for (i = 1; i < tests[j].n_entries*3; i+=3) {
761 assert_se(hashmap_put(h, UINT_TO_PTR(i), UINT_TO_PTR(i)) >= 0);
762 assert_se(PTR_TO_UINT(hashmap_get(h, UINT_TO_PTR(i))) == i);
765 for (i = 1; i < tests[j].n_entries*3; i++)
766 assert_se(hashmap_contains(h, UINT_TO_PTR(i)) == (i % 3 == 1));
768 log_info("%u <= %u * 0.8 = %g", hashmap_size(h), hashmap_buckets(h), hashmap_buckets(h) * 0.8);
770 assert_se(hashmap_size(h) <= hashmap_buckets(h) * 0.8);
771 assert_se(hashmap_size(h) == tests[j].n_entries);
773 while (!hashmap_isempty(h)) {
774 k = hashmap_first_key(h);
775 v = hashmap_remove(h, k);
783 static void test_hashmap_first(void) {
784 _cleanup_hashmap_free_ Hashmap *m = NULL;
786 log_info("%s", __func__);
788 m = hashmap_new(&string_hash_ops);
791 assert_se(!hashmap_first(m));
792 assert_se(hashmap_put(m, "key 1", (void*) "val 1") == 1);
793 assert_se(streq(hashmap_first(m), "val 1"));
794 assert_se(hashmap_put(m, "key 2", (void*) "val 2") == 1);
796 assert_se(streq(hashmap_first(m), "val 1"));
797 assert_se(hashmap_remove(m, "key 1"));
798 assert_se(streq(hashmap_first(m), "val 2"));
802 static void test_hashmap_first_key(void) {
803 _cleanup_hashmap_free_ Hashmap *m = NULL;
805 log_info("%s", __func__);
807 m = hashmap_new(&string_hash_ops);
810 assert_se(!hashmap_first_key(m));
811 assert_se(hashmap_put(m, "key 1", NULL) == 1);
812 assert_se(streq(hashmap_first_key(m), "key 1"));
813 assert_se(hashmap_put(m, "key 2", NULL) == 1);
815 assert_se(streq(hashmap_first_key(m), "key 1"));
816 assert_se(hashmap_remove(m, "key 1") == NULL);
817 assert_se(streq(hashmap_first_key(m), "key 2"));
821 static void test_hashmap_steal_first_key(void) {
822 _cleanup_hashmap_free_ Hashmap *m = NULL;
824 log_info("%s", __func__);
826 m = hashmap_new(&string_hash_ops);
829 assert_se(!hashmap_steal_first_key(m));
830 assert_se(hashmap_put(m, "key 1", NULL) == 1);
831 assert_se(streq(hashmap_steal_first_key(m), "key 1"));
833 assert_se(hashmap_isempty(m));
836 static void test_hashmap_steal_first(void) {
837 _cleanup_hashmap_free_ Hashmap *m = NULL;
841 log_info("%s", __func__);
843 m = hashmap_new(&string_hash_ops);
846 assert_se(hashmap_put(m, "key 1", (void*) "1") == 1);
847 assert_se(hashmap_put(m, "key 2", (void*) "22") == 1);
848 assert_se(hashmap_put(m, "key 3", (void*) "333") == 1);
850 while ((val = hashmap_steal_first(m)))
851 seen[strlen(val) - 1]++;
853 assert_se(seen[0] == 1 && seen[1] == 1 && seen[2] == 1);
855 assert_se(hashmap_isempty(m));
858 static void test_hashmap_clear_free_free(void) {
859 _cleanup_hashmap_free_ Hashmap *m = NULL;
861 log_info("%s", __func__);
863 m = hashmap_new(&string_hash_ops);
866 assert_se(hashmap_put(m, strdup("key 1"), NULL) == 1);
867 assert_se(hashmap_put(m, strdup("key 2"), NULL) == 1);
868 assert_se(hashmap_put(m, strdup("key 3"), NULL) == 1);
870 hashmap_clear_free_free(m);
871 assert_se(hashmap_isempty(m));
874 static void test_hashmap_reserve(void) {
875 _cleanup_hashmap_free_ Hashmap *m = NULL;
877 log_info("%s", __func__);
879 m = hashmap_new(&string_hash_ops);
881 assert_se(hashmap_reserve(m, 1) == 0);
882 assert_se(hashmap_buckets(m) < 1000);
883 assert_se(hashmap_reserve(m, 1000) == 0);
884 assert_se(hashmap_buckets(m) >= 1000);
885 assert_se(hashmap_isempty(m));
887 assert_se(hashmap_put(m, "key 1", (void*) "val 1") == 1);
889 assert_se(hashmap_reserve(m, UINT_MAX) == -ENOMEM);
890 assert_se(hashmap_reserve(m, UINT_MAX - 1) == -ENOMEM);
893 void test_hashmap_funcs(void) {
894 #if 0 /// UNNEEDED by elogind
898 log_parse_environment();
901 #if 0 /// UNNEEDED by elogind
902 r = getenv_bool("SYSTEMD_SLOW_TESTS");
903 arg_slow = r >= 0 ? r : SYSTEMD_SLOW_TESTS_DEFAULT;
907 test_hashmap_get_strv();
908 test_hashmap_move_one();
910 test_hashmap_replace();
911 test_hashmap_update();
913 test_hashmap_remove();
914 test_hashmap_remove2();
915 test_hashmap_remove_value();
916 test_hashmap_remove_and_put();
917 test_hashmap_remove_and_replace();
918 test_hashmap_ensure_allocated();
919 test_hashmap_foreach();
920 test_hashmap_foreach_key();
921 test_hashmap_contains();
922 test_hashmap_merge();
923 test_hashmap_isempty();
928 test_hashmap_first();
929 test_hashmap_first_key();
930 test_hashmap_steal_first_key();
931 test_hashmap_steal_first();
932 test_hashmap_clear_free_free();
933 test_hashmap_reserve();