Ejemplo n.º 1
0
        private static void TestIntervalOps(R1Interval x, R1Interval y, string expected)
        {
            // Test all of the interval operations on the given pair of intervals.
            // "expected" is a sequence of "T" and "F" characters corresponding to
            // the expected results of Contains(), InteriorContains(), Intersects(),
            // and InteriorIntersects() respectively.

            Assert.Equal(expected[0] == 'T', x.Contains(y));
            Assert.Equal(expected[1] == 'T', x.InteriorContains(y));
            Assert.Equal(expected[2] == 'T', x.Intersects(y));
            Assert.Equal(expected[3] == 'T', x.InteriorIntersects(y));

            Assert.Equal(x.Contains(y), x.Union(y) == x);
            Assert.Equal(x.Intersects(y), !x.Intersection(y).IsEmpty());

            R1Interval z = x;

            z = R1Interval.AddInterval(z, y);
            Assert.Equal(x.Union(y), z);
        }