diff options
Diffstat (limited to 'test/hash_test.c')
-rw-r--r-- | test/hash_test.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/hash_test.c b/test/hash_test.c index 2b9bb51..00f1bce 100644 --- a/test/hash_test.c +++ b/test/hash_test.c @@ -158,12 +158,19 @@ stress(void) // Remove strings for (size_t i = 0; i < n_strings; ++i) { + const size_t initial_size = zix_hash_size(hash); + // Remove string ZixStatus st = zix_hash_remove(hash, &strings[i]); if (st) { return test_fail("Failed to remove `%s'\n", strings[i]); } + // Ensure size is updated + if (zix_hash_size(hash) != initial_size - 1) { + return test_fail("Removing node did not decrease hash size\n"); + } + // Ensure second removal fails st = zix_hash_remove(hash, &strings[i]); if (st != ZIX_STATUS_NOT_FOUND) { |