mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:47:45 +00:00
AK: Make Hash{Map,Table}::remove_all_matching() return removal success
These functions now return whether one or more entries were removed.
This commit is contained in:
parent
c7ac0c2c80
commit
5279a04c78
4 changed files with 24 additions and 12 deletions
|
@ -82,17 +82,18 @@ TEST_CASE(remove_all_matching)
|
|||
|
||||
EXPECT_EQ(map.size(), 4u);
|
||||
|
||||
map.remove_all_matching([&](int key, String const& value) {
|
||||
return key == 1 || value == "Two";
|
||||
});
|
||||
EXPECT_EQ(map.remove_all_matching([&](int key, String const& value) { return key == 1 || value == "Two"; }), true);
|
||||
|
||||
EXPECT_EQ(map.size(), 2u);
|
||||
EXPECT(map.contains(3));
|
||||
EXPECT(map.contains(4));
|
||||
|
||||
map.remove_all_matching([&](int, String const&) { return true; });
|
||||
EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return true; }), true);
|
||||
EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return false; }), false);
|
||||
|
||||
EXPECT(map.is_empty());
|
||||
|
||||
EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return true; }), false);
|
||||
}
|
||||
|
||||
TEST_CASE(case_insensitive)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue