summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-17 22:07:51 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-17 22:07:51 +0000
commit5049ee5b11fe55e5a553b5388406aab874717672 (patch)
tree6261142b70a9c2000858a73d350a2cada04a9708 /unittests
parent175fb36f101a20df10db90bfe4d0c44a7d05325b (diff)
downloadexternal_llvm-5049ee5b11fe55e5a553b5388406aab874717672.zip
external_llvm-5049ee5b11fe55e5a553b5388406aab874717672.tar.gz
external_llvm-5049ee5b11fe55e5a553b5388406aab874717672.tar.bz2
It is allowed to call IntervalMap::const_iterator::advanceTo() with a key that
moves the iterator to end(), and it is valid to call it on end(). That means it is valid to call advanceTo() with any monotonic key sequence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/IntervalMapTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/ADT/IntervalMapTest.cpp b/unittests/ADT/IntervalMapTest.cpp
index eb1f1a4..fad7318 100644
--- a/unittests/ADT/IntervalMapTest.cpp
+++ b/unittests/ADT/IntervalMapTest.cpp
@@ -247,6 +247,12 @@ TEST(IntervalMapTest, RootMultiCoalescing) {
EXPECT_EQ(140u, I.start());
EXPECT_EQ(150u, I.stop());
+ I.advanceTo(200);
+ EXPECT_FALSE(I.valid());
+
+ I.advanceTo(300);
+ EXPECT_FALSE(I.valid());
+
// Coalesce left with followers.
// [100;110] [120;130] [140;150] [160;170]
map.insert(111, 115, 1);
@@ -520,6 +526,14 @@ TEST(IntervalMapTest, Branched2) {
EXPECT_EQ(2000u, I.start());
EXPECT_EQ(2005u, I.stop());
+ // advanceTo beyond end()
+ I.advanceTo(20000);
+ EXPECT_FALSE(I.valid());
+
+ // end().advanceTo() is valid as long as x > map.stop()
+ I.advanceTo(30000);
+ EXPECT_FALSE(I.valid());
+
// Test clear() on branched map.
map.clear();
EXPECT_TRUE(map.empty());