mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
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:
parent
d42336312c
commit
f5025c5cb3
Notes:
sideshowbarker
2024-07-17 21:31:58 +09:00
Author: https://github.com/NHOrus 🔰 Commit: https://github.com/SerenityOS/serenity/commit/f5025c5cb31 Pull-request: https://github.com/SerenityOS/serenity/pull/11670
1 changed files with 4 additions and 1 deletions
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue