示例#1
0
    def test_ThreeIntervalsOverlapTwoEqualsEndStart_MergeOverlapDontMergeEquals(
            self):
        intervals = [[6, 9], [8, 12], [11, 14], [14, 16]]

        result = merge_overlap_intervals(intervals)
        expected = [[6, 14], [14, 16]]
        self.assertEqual(result, expected)
示例#2
0
    def test_NoOverlappingIntervals_NoChange(self):
        intervals = [
            [2, 4],
            [6, 9],
            [11, 12],
        ]

        result = merge_overlap_intervals(intervals)
        expected = [
            [2, 4],
            [6, 9],
            [11, 12],
        ]
        self.assertEqual(result, expected)
示例#3
0
    def test_ThreeIntervalsOverlap_Merge(self):
        intervals = [[6, 9], [8, 12], [11, 14]]

        result = merge_overlap_intervals(intervals)
        expected = [[6, 14]]
        self.assertEqual(result, expected)
示例#4
0
    def test_TwoIntervalsEqualEndStart_NoChange(self):
        intervals = [[6, 9], [9, 12]]

        result = merge_overlap_intervals(intervals)
        expected = [[6, 9], [9, 12]]
        self.assertEqual(result, expected)