예제 #1
0
 def test_lengthOrder_withIntervalsWithNotEqualLength_shouldReturnCorrectComparator(
         self):
     for _ in range(1000):
         a = Interval(random.uniform(1, 200), random.uniform(1, 200))
         b = Interval(random.uniform(1, 100), random.uniform(500, 1000))
         self.assertEqual(-1, Interval.length_order(a, b))
         self.assertEqual(1, Interval.length_order(b, a))
예제 #2
0
    def test_lengthOrder_withEqualLengthIntervals_shouldReturnZero(self):
        a = Interval(1, 0)
        b = Interval(1, 0)
        self.assertEqual(0, Interval.length_order(a, b))
        self.assertEqual(0, Interval.length_order(b, a))

        b = Interval(0, 1)
        self.assertEqual(0, Interval.length_order(a, b))
        self.assertEqual(0, Interval.length_order(b, a))

        b = a
        self.assertEqual(0, Interval.length_order(a, b))
        self.assertEqual(0, Interval.length_order(b, a))