How it works
Testing checks whether a program behaves as intended; debugging finds and fixes the cause when it does not.
Use normal, boundary, and unexpected test cases for input, output, and procedure behavior.
Common error
A single successful test does not prove the program works for all cases.
Worked example
A program admits ages 13 through 18 inclusive, but its condition excludes age 18.
Data / pseudocode
Current condition: age >= 13 AND age < 18
Required upper boundary: 18 included
Test input: 18
Actual: rejectedThe failing boundary case identifies a mismatch between the requirement and the comparison. Change the upper comparison to age <= 18, then test 12, 13, 18, and 19 as well as a typical valid age. Testing exposes the fault; debugging identifies and corrects its cause.
Exercises
1.4.1
Provide expected results for ages 12, 13, 18, and 19 under the stated requirement.
Show solution
12: reject. 13: admit. 18: admit. 19: reject. Both boundaries must be included and their adjacent outside values excluded.
1.4.2
Why does one successful test at age 15 not establish that both boundaries work?
Show solution
An interior value can pass under several incorrect comparisons. Boundary and adjacent outside cases distinguish inclusive from exclusive conditions.
