mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 08:57:35 +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
|
@ -95,13 +95,16 @@ TEST_CASE(table_remove_all_matching)
|
|||
|
||||
EXPECT_EQ(ints.size(), 4u);
|
||||
|
||||
ints.remove_all_matching([&](int value) { return value > 2; });
|
||||
EXPECT_EQ(ints.remove_all_matching([&](int value) { return value > 2; }), true);
|
||||
EXPECT_EQ(ints.remove_all_matching([&](int) { return false; }), false);
|
||||
|
||||
EXPECT_EQ(ints.size(), 2u);
|
||||
|
||||
ints.remove_all_matching([&](int) { return true; });
|
||||
EXPECT_EQ(ints.remove_all_matching([&](int) { return true; }), true);
|
||||
|
||||
EXPECT(ints.is_empty());
|
||||
|
||||
EXPECT_EQ(ints.remove_all_matching([&](int) { return true; }), false);
|
||||
}
|
||||
|
||||
TEST_CASE(case_insensitive)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue