Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1793)

Unified Diff: base/containers/flat_set_unittest.cc

Issue 2723853002: Implementing erase/erase_if functions from library fundamentals ts: (Closed)
Patch Set: Compilation on linux. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/containers/flat_set.h ('k') | base/stl_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/containers/flat_set_unittest.cc
diff --git a/base/containers/flat_set_unittest.cc b/base/containers/flat_set_unittest.cc
index 1c7a46a026f3da16d366b234092b6482410551d6..34190ee01efa7cd8f6a632e59667035912abb100 100644
--- a/base/containers/flat_set_unittest.cc
+++ b/base/containers/flat_set_unittest.cc
@@ -1242,3 +1242,17 @@ TEST(FlatSet, Comparison) {
EXPECT_GE(biggest, middle);
EXPECT_GE(biggest, biggest);
}
+
+TEST(FlatSet, EraseIf) {
+ IntSet x;
+ base::EraseIf(x, [](int) { return false; });
+ EXPECT_THAT(x, ElementsAre());
+
+ x = {1, 2, 3};
+ base::EraseIf(x, [](int elem) { return !(elem & 1); });
+ EXPECT_THAT(x, ElementsAre(1, 3));
+
+ x = {1, 2, 3, 4};
+ base::EraseIf(x, [](int elem) { return elem & 1; });
+ EXPECT_THAT(x, ElementsAre(2, 4));
+}
« no previous file with comments | « base/containers/flat_set.h ('k') | base/stl_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698