It includes the famous "Triangle Test":
This program accepts as input three integers which it interprets as the lengths of sides of a triangle. It reports whether the triangle is equilateral, isosceles, or scalene (neither equilateral nor isosceles). Write a set of test data to test this program.
- Do you have a test case which represents a valid scalene triangle?
- Do you have a test case which represents a valid equilateral triangle?
- Do you have a test case which represents a valid isosceles triangle?
- Do you have at least three test cases which represent valid isosceles triangles such that you have tried all three permutations of two equal sides?
- Do you have a test case in which one side is zero?
- Do you have a test case in which one side is negative?
- Do you have a test case with three positive integers such that the sum of two is equal to the third?
- Do you have at least three test cases in category 7 such that you have tried all three permutations where the length of one side is equal to the sum of the lengths of the other two sides?
- Do you have a test case with the sum of two of the numbers less than the third?
- Do you have at least three cases in category 9 such that you have tried all three permutations?
- Do you have a test case with all sides zero?
- Do you have at least one test case specifying non-integer values?
- Do you have at least one test case specifying the wrong number of values (two or four)?
- Most importantly, for each test case, did you specify the expected output?
When I have an audience that may not appreciate the amount of work necessary to create test cases, I sometimes give a presentation and ask that they take this test.
Elisabeth Hendrickson's Test Obsessed site includes a nice Javascript implementation of the program under test here:
http://www.testobsessed.com/exercises/triangle.html
Note: An interesting PowerPoint deck from The University of Limerick's Department of Computer Science and Information Systems Website is here: http://www.csis.ul.ie/Modules/CS5703/BlackBox-Triangle.ppt. It uses the Triangle Test as the basis for demonstrating some testing approaches.