Check Neighbor Cases After Fixing a Bug
Scenario
Someone fixed the `freeSeats >= 0` bug by changing it to `freeSeats > 1`. Compare the candidate fixes across all three boundary neighbors (0, 1, 2).
Try it yourself
Compare both candidate fixes across 0, 1, and 2 seats.
| Case | Result |
|---|---|
| Fix A: freeSeats > 1 | Select a choice above to see what happens. |
| Fix B: freeSeats > 0 | Select a choice above to see what happens. |
| Fix C: if (freeSeats === 0) return false; return true; | Select a choice above to see what happens. |
Reveal the explanation
- Fix A: freeSeats > 1
Passes 0 (false) and 2 (true), but BREAKS neighbor 1 (returns false instead of true)!
- Fix B: freeSeats > 0
Passes 0 (false), 1 (true), and 2 (true) — all neighbors stay green.
- Fix C: if (freeSeats === 0) return false; return true;
Passes 0, 1, 2, but BREAKS invalid neighbor -1 (returns true instead of INVALID_FREE_SEATS)!
Never run only the single newly added test after a fix. Running the entire fixture suite proves you fixed the bug without damaging its neighbors.
Download shared test cases
Your turn
After fixing `score > 60` to pass `score = 60`, list the four neighbor/endpoint cases you must rerun immediately.
Common mistake Running only the single regression test for 60 and assuming 59, 0, 100, and -1 still pass.
Check your work
Rerun list covering 59 (false), 60 (true), 61 (true), 0 (false), 100 (true), and -1 / 101 (INVALID_SCORE).
Quick check
This browser could not save your progress. Changes last until you leave the page.