40/42
Part 8 of 8 · Follow-upsLearn and do
The tests you'd write
- Back to back:
(1, 4)and(4, 7)half-open, which must not overlap, and the closed version,(1, 3)and(4, 7), which must join. - One interval inside another.
- Two identical intervals.
- An empty input and a single interval.
- A range of one day.
- A day nobody covers.
- A twin: the slow version run side by side with the fast one on thousands of small random inputs, as this lesson did for every fast version it shows.
In the editor, overlaps is the right test, and CASES holds one case. Add (a, b, expected) cases to CASES until they catch both broken tests from the start of the lesson: the end test and the closed test.