|
| 1 | +import unittest |
| 2 | +from typing import List |
| 3 | +from parameterized import parameterized |
| 4 | +from algorithms.intervals.can_attend_meetings import can_attend_meetings |
| 5 | + |
| 6 | +CAN_ATTEND_MEETINGS_TEST_CASES = [ |
| 7 | + ([[1, 5], [3, 9], [6, 8]], False), |
| 8 | + ([[10, 12], [6, 9], [13, 15]], True), |
| 9 | + ([[0, 30], [5, 10], [15, 20]], False), |
| 10 | + ([[7, 10], [2, 4]], True), |
| 11 | + ([[1, 2], [2, 3], [3, 4]], True), |
| 12 | + ([[1, 2], [2, 3], [3, 4]], True), |
| 13 | + ([[1, 3], [2, 4], [4, 6]], False), |
| 14 | + ([[0, 1], [3, 5], [6, 7]], True), |
| 15 | + ([[10, 20], [20, 30], [30, 40]], True), |
| 16 | + ([[1, 5], [6, 10], [11, 15]], True), |
| 17 | + ([[5, 10], [15, 20], [10, 15]], True), |
| 18 | +] |
| 19 | + |
| 20 | + |
| 21 | +class CanAttendMeetingsTestCase(unittest.TestCase): |
| 22 | + @parameterized.expand(CAN_ATTEND_MEETINGS_TEST_CASES) |
| 23 | + def test_can_attend_meetings(self, intervals: List[List[int]], expected: bool): |
| 24 | + actual = can_attend_meetings(intervals) |
| 25 | + self.assertEqual(expected, actual) |
| 26 | + |
| 27 | + |
| 28 | +if __name__ == "__main__": |
| 29 | + unittest.main() |
0 commit comments