summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/STLExtrasTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ADT/STLExtrasTest.cpp')
-rw-r--r--llvm/unittests/ADT/STLExtrasTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/STLExtrasTest.cpp b/llvm/unittests/ADT/STLExtrasTest.cpp
index 28e0ebb53f6..f17d24f36b2 100644
--- a/llvm/unittests/ADT/STLExtrasTest.cpp
+++ b/llvm/unittests/ADT/STLExtrasTest.cpp
@@ -297,4 +297,15 @@ TEST(STLExtrasTest, PartitionAdaptor) {
EXPECT_EQ(7, V[7]);
}
+TEST(STLExtrasTest, EraseIf) {
+ std::vector<int> V = {1, 2, 3, 4, 5, 6, 7, 8};
+
+ erase_if(V, [](int i) { return i % 2 == 0; });
+ EXPECT_EQ(4u, V.size());
+ EXPECT_EQ(1, V[0]);
+ EXPECT_EQ(3, V[1]);
+ EXPECT_EQ(5, V[2]);
+ EXPECT_EQ(7, V[3]);
+}
+
}
OpenPOWER on IntegriCloud