示例#1
0
        public void OrderIntervals()
        {
            var intervals = new[]
            {
                T.EmptyInterval,
                T.SingleValueInterval(2),
                T.OpenInterval(1, 3),
                T.ClosedInterval(1, 3),
                T.ClosedOpenInterval(1, 3),
                T.OpenClosedInterval(1, 3),
                T.OpenInterval(1, 2),
                T.ClosedInterval(1, 2),
                T.ClosedOpenInterval(1, 2),
                T.OpenClosedInterval(1, 2),
                T.OpenInterval(2, 3),
                T.ClosedInterval(2, 3),
                T.ClosedOpenInterval(2, 3),
                T.OpenClosedInterval(2, 3),
                T.OpenUnboundedInterval(1),
                T.ClosedUnboundedInterval(1),
                T.UnboundedOpenInterval(3),
                T.UnboundedClosedInterval(3),
                T.UnboundedInterval
            };

            Assert.Equal(
                "Ø, (-∞, 3), (-∞, 3], (-∞, ∞), [1, 2), [1, 2], [1, 3), [1, 3], [1, ∞), (1, 2), (1, 2], (1, 3), (1, 3], (1, ∞), [2], [2, 3), [2, 3], (2, 3), (2, 3]",
                String.Join(", ", T.Order(intervals, Ordering.Ascending))
                );
            Assert.Equal(
                "(2, 3], (2, 3), [2, 3], [2, 3), [2], (1, ∞), (1, 3], (1, 3), (1, 2], (1, 2), [1, ∞), [1, 3], [1, 3), [1, 2], [1, 2), (-∞, ∞), (-∞, 3], (-∞, 3), Ø",
                String.Join(", ", T.Order(intervals, Ordering.Descending))
                );
        }
示例#2
0
        public void TestOrder2()
        {
            TotalOrder totalOrder = new TotalOrder();

            Submission[] submissions = new[]
            {
                new Submission {
                    Indexes = new[] { 3, 4, 1, 0, 2 }
                },
                new Submission {
                    Indexes = new[] { 0, 2, 1, 3, 4 }
                }
            };
            int[] testRef = new int[] { 0, 3, 1, 2, 4 };

            var result = totalOrder.Order(submissions);

            result.Should().Equal(testRef);
        }