public void IntersectionOfSegmentsPartialIntersection()
        {
            var a = new IntegerSegment(1, 4);
            var b = new IntegerSegment(2, 8);

            Assert.AreEqual(new IntegerSegment(2, 4), IntegerSegmentUtils.IntersectionOfSegments(a, b));
            Assert.AreEqual(new IntegerSegment(2, 4), IntegerSegmentUtils.IntersectionOfSegments(b, a));
        }
        public void IntersectionOfSegmentsNoIntersection()
        {
            var result = IntegerSegmentUtils.IntersectionOfSegments(
                new IntegerSegment(1, 2),
                new IntegerSegment(4, 5));

            Assert.AreEqual(IntegerSegment.Zero, result);
        }
        public void IntersectionOfSegmentsFullIntersection()
        {
            var result = IntegerSegmentUtils.IntersectionOfSegments(
                new IntegerSegment(1, 2),
                new IntegerSegment(1, 2));

            Assert.AreEqual(new IntegerSegment(1, 2), result);
        }
        public void IntersectionOfSegments()
        {
            var result = IntegerSegmentUtils.IntersectionOfSegments(new[]
            {
                new[] { new IntegerSegment(1, 2), new IntegerSegment(4, 6) },
                new[] { new IntegerSegment(1, 2), new IntegerSegment(5, 10) },
            });

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(new IntegerSegment(1, 2), result[0]);
            Assert.AreEqual(new IntegerSegment(5, 6), result[1]);
        }