summaryrefslogtreecommitdiff
path: root/src/hash_map.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash_map.cc')
-rw-r--r--src/hash_map.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hash_map.cc b/src/hash_map.cc
index 4e45ab26..6972f34b 100644
--- a/src/hash_map.cc
+++ b/src/hash_map.cc
@@ -30,12 +30,23 @@ UnitTest test_hash_map{[] {
kak_assert(map.size() == 2);
}
- // Multiple entries with the same key
+ // Replace Multiple entries with the same key
{
HashMap<int, int> map;
map.insert({10, 1});
map.insert({10, 2});
kak_assert(map.find_index(10) == 0);
+ kak_assert(map[10] == 2);
+ map.remove(10);
+ kak_assert(map.find_index(10) == -1);
+ }
+
+ // Multiple entries with the same key
+ {
+ MultiHashMap<int, int> map;
+ map.insert({10, 1});
+ map.insert({10, 2});
+ kak_assert(map.find_index(10) == 0);
map.remove(10);
kak_assert(map.find_index(10) == 0);
map.remove(10);