From 4c6564e3c1143b27f29f3fd551cce3b99fa4b836 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Fri, 28 Apr 2023 15:02:38 +0300 Subject: AK: Add values() method in HashTable Add HashTable::values() method that returns all values. --- Tests/AK/TestHashTable.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Tests/AK') diff --git a/Tests/AK/TestHashTable.cpp b/Tests/AK/TestHashTable.cpp index 9d25c48739..47b13da09f 100644 --- a/Tests/AK/TestHashTable.cpp +++ b/Tests/AK/TestHashTable.cpp @@ -10,6 +10,7 @@ #include #include #include +#include TEST_CASE(construct) { @@ -434,3 +435,18 @@ TEST_CASE(ordered_infinite_loop_clang_regression) } } } + +TEST_CASE(values) +{ + OrderedHashTable table; + table.set(10); + table.set(30); + table.set(20); + + Vector values = table.values(); + + EXPECT_EQ(values.size(), table.size()); + EXPECT_EQ(values[0], 10); + EXPECT_EQ(values[1], 30); + EXPECT_EQ(values[2], 20); +} -- cgit v1.2.3