Beispiel #1
0
    public static void Main(string[] args)
    {
        var boundedOpenInterval = Interval <int> .Bounded(0, Edge.Open, 10, Edge.Open);

        var boundedClosedInterval = Interval <int> .Bounded(0, Edge.Closed, 10, Edge.Closed);

        var smallerInterval = Interval <int> .Bounded(3, Edge.Closed, 7, Edge.Closed);

        var leftBoundedOpenInterval = Interval <int> .LeftBounded(10, Edge.Open);

        var leftBoundedClosedInterval = Interval <int> .LeftBounded(10, Edge.Closed);

        var rightBoundedOpenInterval = Interval <int> .RightBounded(0, Edge.Open);

        var rightBoundedClosedInterval = Interval <int> .RightBounded(0, Edge.Closed);

        Assert.That(
            boundedOpenInterval.Includes(smallerInterval)
            );
        Assert.That(
            boundedOpenInterval.Includes(5)
            );
        Assert.That(
            leftBoundedClosedInterval.Includes(100)
            );
        Assert.That(
            !leftBoundedClosedInterval.Includes(5)
            );
        Assert.That(
            rightBoundedClosedInterval.Includes(-100)
            );
        Assert.That(
            !rightBoundedClosedInterval.Includes(5)
            );
    }