public void IntersectionCount_OuterStrictLowerBounds() { var ranges = new[] { Range(0, 5, true), Range(1, 4) }; var intersectionCounts = ranges.IntersectionCount().ToList(); intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 1, true))); intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0], ranges[1] }, Range(1, 4))); intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(4, 5))); }
public void IntersectionCount_Gaps() { var ranges = new[] { Range(0, 5), Range(7, 10) }; var intersectionCounts = ranges.IntersectionCount().ToList(); intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 5))); intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new INumberRange<int>[0], Range(5, 7))); intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[1] }, Range(7, 10))); }
public void IntersectionCount_InnerNonStrictUpperBounds() { var ranges = new[] { Range(0, 5), Range(1, 4, false, false) }; var intersectionCounts = ranges.IntersectionCount().ToList(); intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 1))); intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0], ranges[1] }, Range(1, 4, false, false))); intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(4, 5, true))); }
public void IntersectionCount() { var ranges = new[] { Range(0, 5), Range(1, 4) }; var intersectionCounts = ranges.IntersectionCount().ToList(); intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 1))); intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0], ranges[1] }, Range(1, 4))); intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(4, 5))); }