summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/MapVectorTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ADT/MapVectorTest.cpp')
-rw-r--r--llvm/unittests/ADT/MapVectorTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/MapVectorTest.cpp b/llvm/unittests/ADT/MapVectorTest.cpp
index 11178bc15e8..dd84e7ebd13 100644
--- a/llvm/unittests/ADT/MapVectorTest.cpp
+++ b/llvm/unittests/ADT/MapVectorTest.cpp
@@ -53,3 +53,18 @@ TEST(MapVectorTest, insert_pop) {
EXPECT_EQ(MV[1], 2);
EXPECT_EQ(MV[4], 7);
}
+
+TEST(MapVectorTest, erase) {
+ MapVector<int, int> MV;
+
+ MV.insert(std::make_pair(1, 2));
+ MV.insert(std::make_pair(3, 4));
+ MV.insert(std::make_pair(5, 6));
+ ASSERT_EQ(MV.size(), 3u);
+
+ MV.erase(MV.find(1));
+ ASSERT_EQ(MV.size(), 2u);
+ ASSERT_EQ(MV.find(1), MV.end());
+ ASSERT_EQ(MV[3], 4);
+ ASSERT_EQ(MV[5], 6);
+}
OpenPOWER on IntegriCloud