Curriculum

Curriculum

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).

Selected choicePick a choice below
Result—

Try it yourself

Compare both candidate fixes across 0, 1, and 2 seats.

Reveal the explanation
  1. Fix A: freeSeats > 1

    Passes 0 (false) and 2 (true), but BREAKS neighbor 1 (returns false instead of true)!

  2. Fix B: freeSeats > 0

    Passes 0 (false), 1 (true), and 2 (true) — all neighbors stay green.

  3. 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.

Review first
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

Why should you rerun the full fixture suite—not only the new regression test—after editing code?
Show the answer and reasoning

Correct answer A fix can pass the new case while accidentally breaking an adjacent boundary or invalid case

Full-suite reruns verify there are no side-effect regressions on neighboring inputs.