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 | b1c67569c34180bcd911b48dd5b8e96c2fd8e3f9 (patch) | |
tree | 552d86ae12ce083848157f027df489b057c2df50 /llvm/unittests/ADT/MapVectorTest.cpp | |
parent | e758da20806cbae6db7760d38d187e076f6c3ea2 (diff) | |
download | bcm5719-llvm-b1c67569c34180bcd911b48dd5b8e96c2fd8e3f9.tar.gz bcm5719-llvm-b1c67569c34180bcd911b48dd5b8e96c2fd8e3f9.zip |
Remove my bogus MapVector::erase() with a narrower ::pop_back(), and add a unit test.
llvm-svn: 175538
Diffstat (limited to 'llvm/unittests/ADT/MapVectorTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/MapVectorTest.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/unittests/ADT/MapVectorTest.cpp b/llvm/unittests/ADT/MapVectorTest.cpp index 9f613697d57..11178bc15e8 100644 --- a/llvm/unittests/ADT/MapVectorTest.cpp +++ b/llvm/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); } |