mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
Add basic test exposing many bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121995 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2036,11 +2036,11 @@ class IntervalMapOverlaps {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
// Make a.end > b.start.
|
// Make a.end > b.start.
|
||||||
posA.advanceTo(posB.start());
|
posA.advanceTo(posB.start());
|
||||||
if (!posA.valid() || !Traits::stopLess(posB.end(), posA.start()))
|
if (!posA.valid() || !Traits::stopLess(posB.stop(), posA.start()))
|
||||||
return;
|
return;
|
||||||
// Make b.end > a.start.
|
// Make b.end > a.start.
|
||||||
posB.advanceTo(posA.start());
|
posB.advanceTo(posA.start());
|
||||||
if (!posB.valid() || !Traits::stopLess(posA.end(), posB.start()))
|
if (!posB.valid() || !Traits::stopLess(posA.stop(), posB.start()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2068,11 +2068,11 @@ public:
|
|||||||
/// skipA - Move to the next overlap that doesn't involve a().
|
/// skipA - Move to the next overlap that doesn't involve a().
|
||||||
void skipA() {
|
void skipA() {
|
||||||
++posA;
|
++posA;
|
||||||
if (!posA.valid() || !Traits::stopLess(posB.end(), posA.start()))
|
if (!posA.valid() || !Traits::stopLess(posB.stop(), posA.start()))
|
||||||
return;
|
return;
|
||||||
// Second half-loop of advance().
|
// Second half-loop of advance().
|
||||||
posB.advanceTo(posA.start());
|
posB.advanceTo(posA.start());
|
||||||
if (!posB.valid() || !Traits::stopLess(posA.end(), posB.start()))
|
if (!posB.valid() || !Traits::stopLess(posA.stop(), posB.start()))
|
||||||
return ;
|
return ;
|
||||||
advance();
|
advance();
|
||||||
}
|
}
|
||||||
@@ -2080,7 +2080,7 @@ public:
|
|||||||
/// skipB - Move to the next overlap that doesn't involve b().
|
/// skipB - Move to the next overlap that doesn't involve b().
|
||||||
void skipB() {
|
void skipB() {
|
||||||
++posB;
|
++posB;
|
||||||
if (!posB.valid() || !Traits::stopLess(posA.end(), posB.start()))
|
if (!posB.valid() || !Traits::stopLess(posA.stop(), posB.start()))
|
||||||
return;
|
return;
|
||||||
advance();
|
advance();
|
||||||
}
|
}
|
||||||
@@ -2088,7 +2088,7 @@ public:
|
|||||||
/// Preincrement - Move to the next overlap.
|
/// Preincrement - Move to the next overlap.
|
||||||
IntervalMapOverlaps &operator++() {
|
IntervalMapOverlaps &operator++() {
|
||||||
// Bump the iterator that ends first. The other one may have more overlaps.
|
// Bump the iterator that ends first. The other one may have more overlaps.
|
||||||
if (Traits::startLess(posB.end(), posA.end()))
|
if (Traits::startLess(posB.stop(), posA.stop()))
|
||||||
skipB();
|
skipB();
|
||||||
else
|
else
|
||||||
skipA();
|
skipA();
|
||||||
|
@@ -550,4 +550,19 @@ TEST(IntervalMapTest, RandomCoalescing) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(IntervalMapOverlapsTest, EmptyMaps) {
|
||||||
|
typedef IntervalMapOverlaps<UUMap,UUMap> UUOverlaps;
|
||||||
|
UUMap::Allocator allocator;
|
||||||
|
UUMap mapA(allocator);
|
||||||
|
UUMap mapB(allocator);
|
||||||
|
|
||||||
|
// empty, empty.
|
||||||
|
EXPECT_FALSE(UUOverlaps(mapA, mapB).valid());
|
||||||
|
|
||||||
|
mapA.insert(1, 2, 3);
|
||||||
|
// full, empty
|
||||||
|
EXPECT_FALSE(UUOverlaps(mapA, mapB).valid());
|
||||||
|
// empty, full
|
||||||
|
EXPECT_FALSE(UUOverlaps(mapB, mapA).valid());
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Reference in New Issue
Block a user