1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:27:45 +00:00

AK: Add test for unbounded HashTable capacity leak

This commit is contained in:
Andreas Kling 2022-03-06 19:37:26 +01:00
parent 9d8da1697e
commit 455224d476

View file

@ -224,3 +224,13 @@ TEST_CASE(basic_contains)
EXPECT_EQ(table.remove(1), true);
EXPECT_EQ(table.contains(1), false);
}
TEST_CASE(capacity_leak)
{
HashTable<int> table;
for (size_t i = 0; i < 10000; ++i) {
table.set(i);
table.remove(i);
}
EXPECT(table.capacity() < 100u);
}