Test an Algorithm at Its Boundary
Choose test cases below, at, and above a rule’s threshold.
Supplied materials
- Paper and a pencil, or say your answers aloud.
Learn the idea
A boundary is the value where a rule changes behavior. Test cases close to that boundary can catch a mistake that an ordinary example misses. State the input, the expected output, and the rule that gives that output.
Our fictional reading-club algorithm is “If pages read is at least 10, show Goal reached; otherwise show Keep going.” At least 10 means 10 or more, so 9, 10, and 11 are useful tests. This is a paper example, not a score saved to an account.
- Write a table with inputs 9, 10, and 11.
- For each input, decide whether it is 10 or more.
- Record expected messages: Keep going, Goal reached, Goal reached.
- Compare with a mistaken rule that uses more than 10, which would treat 10 incorrectly.
See the method in action
Input 9 gives Keep going. Input 10 gives Goal reached because equality satisfies “at least.” Input 11 also gives Goal reached.
Check your reasoning
Your answer is temporary and is not saved to an account. Download your current answer before leaving or reloading. Written work on paper or in another app stays in your own file.
See the answer and explanation
Goal reached
Exactly 10 satisfies “at least 10,” so the expected message is Goal reached. The incorrect rule “more than 10” would exclude 10, which is why this boundary test matters.
Take it further
Change the threshold to at least 6. Test 5, 6, and 7: expected messages are Keep going, Goal reached, Goal reached. Explain why a test of 20 alone would not reveal the difference between at least 6 and more than 6.
Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback.
Check the subject sources
These LifeStarter passages, scenarios and exercises are authored for this Academy with AI assistance and review. External resources keep their publishers’ terms. A grade label suggests a starting level; it does not establish alignment with your school’s complete requirements.