AK: Ensure negative predicate in TestHashMap could run unsuccessfully

As it was, negative predicate test for remove_all_matching was
run on empty hash map, and could not remove anything, so test always
returned true. By duplicating it in state where hash maps contains
elements, we make sure that negative predicate has something to
do nothing on.
This commit is contained in:
NHOrus 2022-01-06 19:06:59 +03:00 committed by Andreas Kling
parent d42336312c
commit f5025c5cb3
Notes: sideshowbarker 2024-07-17 21:31:58 +09:00

View file

@ -83,8 +83,11 @@ TEST_CASE(remove_all_matching)
EXPECT_EQ(map.size(), 4u);
EXPECT_EQ(map.remove_all_matching([&](int key, String const& value) { return key == 1 || value == "Two"; }), true);
EXPECT_EQ(map.size(), 2u);
EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return false; }), false);
EXPECT_EQ(map.size(), 2u);
EXPECT(map.contains(3));
EXPECT(map.contains(4));