From e1463e1ea2d9c81b988771d52306d8cffc1acc70 Mon Sep 17 00:00:00 2001 From: Mosder Date: Mon, 14 Sep 2026 17:00:38 +0200 Subject: feat: improved trigger for shrinking the hashmap --- tests/ds/hashmap_tests.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/ds/hashmap_tests.c b/tests/ds/hashmap_tests.c index b6983fa..4c615a7 100644 --- a/tests/ds/hashmap_tests.c +++ b/tests/ds/hashmap_tests.c @@ -1,5 +1,5 @@ #define _GNU_SOURCE -#define MOS_HM_LOAD_FACTOR 1 +#define MOS_HM_LOAD_FACTOR 100 #include "hashmap_tests.h" #include "moslib/ds/hashmap.h" @@ -79,6 +79,11 @@ TEST(deleting) { test_assert(hm_get_e(hm, 1.0) == NULL, "expansion revived entry"); test_assert(hm_size(hm) == 2 * INIT_CAP + 1, "hm_size after expansion is incorrect"); + E *e = NULL; + while ((e = hm_next(hm, e))) + hm_del_norehash(hm, e->key); + test_assert(hm_size(hm) == 0, "hm_del_norehash in a loop didn't work properly"); + hm_free(hm); } -- cgit v1.2.3