Improved test to catch missing case.
llvm-svn: 188304
/// @{
/// \brief Whether this range overlaps with \p RHS or not.
bool overlapsWith(Range RHS) const {
- if ((Offset + Length) <= RHS.Offset || Offset >= (RHS.Offset + RHS.Length))
- return false;
- return true;
+ return Offset + Length > RHS.Offset && Offset < RHS.Offset + RHS.Length;
}
/// \brief Whether this range contains \p RHS or not.
EXPECT_FALSE(Range(10, 10).overlapsWith(Range(0, 10)));
EXPECT_FALSE(Range(0, 10).overlapsWith(Range(10, 10)));
EXPECT_TRUE(Range(0, 10).overlapsWith(Range(2, 6)));
+ EXPECT_TRUE(Range(2, 6).overlapsWith(Range(0, 10)));
}
TEST(Range, contains) {