// whether it would fit in a continuous segment of the input
// addr range.
if (r.interleaved()) {
- return r.contains(_start) && r.contains(_end) &&
+ return r.contains(_start) && r.contains(_end - 1) &&
size() <= r.granularity();
} else {
return _start >= r._start && _end <= r._end;
EXPECT_FALSE(r2.isSubset(r1));
}
+TEST(AddrRangeTest, isSubsetInterleavedCompleteOverlap)
+{
+ AddrRange r1(0x00, 0x100, {0x40}, 0);
+ AddrRange r2(0x00, 0x40);
+
+ EXPECT_TRUE(r2.isSubset(r1));
+}
+
+TEST(AddrRangeTest, isSubsetInterleavedNoOverlap)
+{
+ AddrRange r1(0x00, 0x100, {0x40}, 1);
+ AddrRange r2(0x00, 0x40);
+
+ EXPECT_FALSE(r2.isSubset(r1));
+}
+
+TEST(AddrRangeTest, isSubsetInterleavedPartialOverlap)
+{
+ AddrRange r1(0x00, 0x100, {0x40}, 0);
+ AddrRange r2(0x10, 0x50);
+
+ EXPECT_FALSE(r2.isSubset(r1));
+}
+
TEST(AddrRangeTest, Contains)
{
AddrRange r(0xF0, 0xF5);
AddrRange r = RangeSize(0x5, 5);
EXPECT_EQ(0x5, r.start());
EXPECT_EQ(0xA, r.end());
-}
\ No newline at end of file
+}