diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2023-04-28 15:02:38 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-28 18:11:44 +0200 |
commit | 4c6564e3c1143b27f29f3fd551cce3b99fa4b836 (patch) | |
tree | 73a95030a81a5387049795c1dea1c154da3fc067 /Tests/AK | |
parent | c9c8f2413f425138e798e1cf57314fdc5a480053 (diff) | |
download | serenity-4c6564e3c1143b27f29f3fd551cce3b99fa4b836.zip |
AK: Add values() method in HashTable
Add HashTable::values() method that returns all values.
Diffstat (limited to 'Tests/AK')
-rw-r--r-- | Tests/AK/TestHashTable.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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 <AK/DeprecatedString.h> #include <AK/HashTable.h> #include <AK/NonnullOwnPtr.h> +#include <AK/Vector.h> TEST_CASE(construct) { @@ -434,3 +435,18 @@ TEST_CASE(ordered_infinite_loop_clang_regression) } } } + +TEST_CASE(values) +{ + OrderedHashTable<int> table; + table.set(10); + table.set(30); + table.set(20); + + Vector<int> values = table.values(); + + EXPECT_EQ(values.size(), table.size()); + EXPECT_EQ(values[0], 10); + EXPECT_EQ(values[1], 30); + EXPECT_EQ(values[2], 20); +} |