Test Empty Lists and Single-Item Lists
Scenario
Test findMaxFreeSeats(seatList) on [], [4], and [2, 5, 1].
Try it yourself
Compare what length-0 and length-1 fixtures expose.
| Case | Result |
|---|---|
| seatList = [] | Select a choice above to see what happens. |
| seatList = [4] | Select a choice above to see what happens. |
| seatList = [2, 5, 1] | Select a choice above to see what happens. |
Reveal the explanation
- seatList = []
Returns NO_ROOMS instead of crashing on seatList[0].
- seatList = [4]
Returns 4 — catches loops that start at index 1 or skip the last item.
- seatList = [2, 5, 1]
Returns 5 — confirms full traversal across multiple items.
Every list function deserves at least three shape tests: 0 items, 1 item, and 3+ items.
Download shared test cases
Your turn
Write 0-item, 1-item, and 3-item test cases for scoreQuiz(answerKey, studentAnswers).
Common mistake Testing only 3-question quizzes and never verifying ([], []) or (["A"], ["A"]).
Check your work
([], []) -> 0; (["A"], ["A"]) -> 1; (["A","B","C"], ["A","X","C"]) -> 2.
Quick check
This browser could not save your progress. Changes last until you leave the page.