public void VariableUseRange_Intersects_Inside() { var range1 = new VariableUseRange("a", 10, 20); var range2 = new VariableUseRange("b", 12, 15); Assert.IsTrue(range1.IntersectsWith(range2)); }
public void VariableUseRange_Intersects_After() { var range1 = new VariableUseRange("a", 0, 10); var range2 = new VariableUseRange("b", 11, 15); Assert.IsFalse(range1.IntersectsWith(range2)); }
public void VariableUseRange_Intersects_BeforeOverlap() { var range1 = new VariableUseRange("a", 10, 15); var range2 = new VariableUseRange("b", 5, 10); Assert.IsFalse(range1.IntersectsWith(range2)); }
public bool IntersectsWith(VariableUseRange other) => !(End <= other.Start || Start >= other.End);