summaryrefslogtreecommitdiff
path: root/AK/Tests/TestHashMap.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-27 16:36:31 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-27 16:36:31 +0200
commit2282e89d3ff366d760dc768a7da551d21fafb105 (patch)
treeea1fa59e12308abcb2aef48711c7e545d24f28cd /AK/Tests/TestHashMap.cpp
parent7f613c79cd0adff0df54e442d6f8b9bc435c6377 (diff)
downloadserenity-2282e89d3ff366d760dc768a7da551d21fafb105.zip
AK: Use a SinglyLinkedList<T> as HashTable's bucket chain storage.
We were using a DoublyLinkedList<T> simply because it supported remove(). This patch consolidates the SinglyLinkedList iterators and adds remove().
Diffstat (limited to 'AK/Tests/TestHashMap.cpp')
-rw-r--r--AK/Tests/TestHashMap.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/AK/Tests/TestHashMap.cpp b/AK/Tests/TestHashMap.cpp
index f3ec4cd9de..0820cd9c42 100644
--- a/AK/Tests/TestHashMap.cpp
+++ b/AK/Tests/TestHashMap.cpp
@@ -23,6 +23,14 @@ int main()
++loop_counter;
}
+ number_to_string.remove(1);
+ EXPECT_EQ(number_to_string.size(), 2);
+ EXPECT(number_to_string.find(1) == number_to_string.end());
+
+ number_to_string.remove(3);
+ EXPECT_EQ(number_to_string.size(), 1);
+ EXPECT(number_to_string.find(3) == number_to_string.end());
+
EXPECT_EQ(loop_counter, 3);
return 0;
}