def testMultiple(self): """test empty input.""" self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(0, 5)]), [(0, 5)]) self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(0, 10)]), [(0, 5)]) self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(0, 15)]), [(0, 5), (10, 15)]) self.assertEqual(Intervals.intersect([(0, 5), (5, 10)], [(0, 10)]), [(0, 5), (5, 10)])
def testSingle(self): """test empty input.""" self.assertEqual(Intervals.intersect([(0, 5)], [(0, 5)]), [(0, 5)]) self.assertEqual(Intervals.intersect([(0, 5)], [(0, 3)]), [(0, 3)]) self.assertEqual(Intervals.intersect([(0, 3)], [(0, 5)]), [(0, 3)]) self.assertEqual(Intervals.intersect([(0, 5)], [(3, 5)]), [(3, 5)]) self.assertEqual(Intervals.intersect([(3, 5)], [(0, 5)]), [(3, 5)]) self.assertEqual(Intervals.intersect([(5, 10)], [(5, 20)]), [(5, 10)]) self.assertEqual(Intervals.intersect([(5, 10)], [(0, 20)]), [(5, 10)])
def testNoOverlap(self): """test empty input.""" self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(5, 10)]), []) self.assertEqual(Intervals.intersect([(5, 10)], [(0, 5), (10, 15)]), [])
def testHalfEmpty(self): """test empty input.""" self.assertEqual(Intervals.intersect([(0, 5)], []), []) self.assertEqual(Intervals.intersect([], [(0, 5)]), [])
def testEmpty(self): """test empty input.""" self.assertEqual(Intervals.intersect([], []), [])