public void DifferenceWith_WhenThisIntervalIsContainedByOtherInterval_ReturnsNull() { var intervalA = new IntegerInterval(1, false, 2, false); var intervalB = new IntegerInterval(0, false, 3, false); var actual = intervalA.DifferenceWith(intervalB); Assert.That(actual, Is.Null); }
public void DifferenceWith_FromEmptyInterval_ReturnsNull() { var intervalA = new IntegerInterval(2, false, 2, false); var intervalB = new IntegerInterval(0, false, 3, false); var actual = intervalA.DifferenceWith(intervalB); Assert.That(actual, Is.Null); }
public void DifferenceWith_WithEmptyInterval_ReturnsThisInterval() { var intervalA = new IntegerInterval(0, false, 3, false); var intervalB = new IntegerInterval(2, false, 2, false); var actual = intervalA.DifferenceWith(intervalB); Assert.That(actual, Is.EquivalentTo(new[] { intervalA })); }
public void DifferenceWith_WhenWhollyOverlappedExceptEndPoints_ReturnsTwoDegenerateIntervalsForTheEndPoints() { var intervalA = new IntegerInterval(0, true, 3, true); var intervalB = new IntegerInterval(0, false, 3, false); var actual = intervalA.DifferenceWith(intervalB); Assert.That(actual.Count, Is.EqualTo(2)); Assert.That(actual[0].Start, Is.EqualTo(actual[0].End)); Assert.That(actual[1].Start, Is.EqualTo(actual[1].End)); }
public void DifferenceWith_WhenOtherIntervalContainedByThis_ReturnsTwoIntervalsThatDontIntersectOther() { var intervalA = new IntegerInterval(0, true, 3, true); var intervalB = new IntegerInterval(1, true, 2, true); var actual = intervalA.DifferenceWith(intervalB); Assert.That(actual.Count, Is.EqualTo(2)); Assert.That(actual[0].IntersectWith(intervalB).IsEmpty()); Assert.That(actual[1].IntersectWith(intervalB).IsEmpty()); }
public void DifferenceWith_WhenOtherOverlapsThisEnd_ReturnsNewIntervalExcludingStart() { var intervalA = new IntegerInterval(0, true, 2, true); var intervalB = new IntegerInterval(1, true, 3, true); var actual = intervalA.DifferenceWith(intervalB); var single = actual.Single(); // Asserts that the array contains a single entry. Assert.That(single.End, Is.EqualTo(intervalB.Start)); Assert.That(single.EndInclusive, Is.False); }
public void DifferenceWith_WithIntervalsIntersectingAtEndPoint_ReturnsNewIntervalExcludingEnd() { var intervalA = new IntegerInterval(0, true, 3, true); var intervalB = new IntegerInterval(3, true, 3, true); var actual = intervalA.DifferenceWith(intervalB); var single = actual.Single(); // Asserts that the array contains a single entry. Assert.That(single.End, Is.EqualTo(intervalA.End)); Assert.That(single.EndInclusive, Is.False); }
public void DifferenceWith_WithIntervalsIntersectingAtStartPoint_ReturnsNewIntervalExcludingStart() { var intervalA = new IntegerInterval(0, true, 3, true); var intervalB = new IntegerInterval(0, true, 0, true); var actual = intervalA.DifferenceWith(intervalB); var single = actual.Single(); // Asserts that the array contains a single entry. Assert.That(single.Start, Is.EqualTo(intervalA.Start)); Assert.That(single.StartInclusive, Is.False); }
public void DifferenceWith_WhenOtherOverlapsThisStart_ReturnsNewIntervalExcludingStart() { var intervalA = new IntegerInterval(1, true, 3, true); var intervalB = new IntegerInterval(0, true, 2, true); var actual = intervalA.DifferenceWith(intervalB); var single = actual.Single(); // Asserts that the array contains a single entry. Assert.That(single.Start, Is.EqualTo(intervalB.End)); Assert.That(single.StartInclusive, Is.False); }