diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-02-19 18:26:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-02-19 18:26:07 +0000 |
commit | 1f1713ff7a53c9c491c59886984f6a0534ce3630 (patch) | |
tree | c45abfb5e9ff2378d8a45abab4dd31fb8f64fdac /unittests/ADT | |
parent | 383c6fc458ebd2bb7748483de56a97b68f3a9f2d (diff) | |
download | external_llvm-1f1713ff7a53c9c491c59886984f6a0534ce3630.zip external_llvm-1f1713ff7a53c9c491c59886984f6a0534ce3630.tar.gz external_llvm-1f1713ff7a53c9c491c59886984f6a0534ce3630.tar.bz2 |
Remove my bogus MapVector::erase() with a narrower ::pop_back(), and add a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ADT')
-rw-r--r-- | unittests/ADT/MapVectorTest.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/unittests/ADT/MapVectorTest.cpp b/unittests/ADT/MapVectorTest.cpp index 9f61369..11178bc 100644 --- a/unittests/ADT/MapVectorTest.cpp +++ b/unittests/ADT/MapVectorTest.cpp @@ -13,7 +13,7 @@ using namespace llvm; -TEST(MapVectorTest, insert) { +TEST(MapVectorTest, insert_pop) { MapVector<int, int> MV; std::pair<MapVector<int, int>::iterator, bool> R; @@ -38,4 +38,18 @@ TEST(MapVectorTest, insert) { EXPECT_EQ(MV.size(), 2u); EXPECT_EQ(MV[1], 2); EXPECT_EQ(MV[4], 5); + + MV.pop_back(); + EXPECT_EQ(MV.size(), 1u); + EXPECT_EQ(MV[1], 2); + + R = MV.insert(std::make_pair(4, 7)); + ASSERT_NE(R.first, MV.end()); + EXPECT_EQ(R.first->first, 4); + EXPECT_EQ(R.first->second, 7); + EXPECT_TRUE(R.second); + + EXPECT_EQ(MV.size(), 2u); + EXPECT_EQ(MV[1], 2); + EXPECT_EQ(MV[4], 7); } |