diff --git a/tests/ChainingHashMap.cc b/tests/ChainingHashMap.cc index 769e7fb..108c81c 100644 --- a/tests/ChainingHashMap.cc +++ b/tests/ChainingHashMap.cc @@ -88,4 +88,17 @@ TEST(ChainingHashMap, Resize) map[7] = 70; map[8] = 80; EXPECT_EQ(map.getBucketCount(), 16); +} + +// Test for existence of key +TEST(ChainingHashMap, ExistenceOfKey) +{ + benn::ChainingHashMap map; + + EXPECT_EQ(map.count(0), 0); + map[0] = 10; + + EXPECT_EQ(map.count(0), 1); + EXPECT_EQ(map.count(1), 0); + EXPECT_EQ(map.count(10), 0); } \ No newline at end of file diff --git a/tests/OpenAddressingHashMap.cc b/tests/OpenAddressingHashMap.cc index 57b69a9..03abccf 100644 --- a/tests/OpenAddressingHashMap.cc +++ b/tests/OpenAddressingHashMap.cc @@ -88,4 +88,17 @@ TEST(OpenAddressingHashMap, Resize) map[7] = 70; map[8] = 80; EXPECT_EQ(map.getBucketCount(), 16); +} + +// Test for existence of key +TEST(OpenAddressingHashMap, ExistenceOfKey) +{ + benn::OpenAddressingHashMap map; + + EXPECT_EQ(map.count(0), 0); + map[0] = 10; + + EXPECT_EQ(map.count(0), 1); + EXPECT_EQ(map.count(1), 0); + EXPECT_EQ(map.count(10), 0); } \ No newline at end of file