Testing your solutions is very important, and it can take a while to learn how to be a good tester.
One commonly used, effective way is to write a test plan.:w
A test plan is a written list of example inputs and the expected output from your programs. A test plan does not require a specific format, but often a table can make it very clear. Here is a test plan for a Grading Criteria Algorithm.
Figure 2-6: Test Plan for our Grading Criteria Algorithm
Input | Expected Output | Type of Test |
103.64 | A | Bounds, Branch, or Error? |
100 | A | Bounds, Branch, or Error? |
95.0 | A | Bounds, Branch, or Error? |
90.1 | A | Bounds, Branch, or Error? |
90.0 | A | Bounds, Branch, or Error? |
89.932 | B | Bounds, Branch, or Error? |
83.0 | B | Bounds, Branch, or Error? |
80.5 | B | Bounds, Branch, or Error? |
80.0 | B | Bounds, Branch, or Error? |
79.7 | C | Bounds, Branch, or Error? |
73.5 | C | Bounds, Branch, or Error? |
70.1 | C | Bounds, Branch, or Error? |
70.0 | C | Bounds, Branch, or Error? |
69.813 | D | Bounds, Branch, or Error? |
60.12 | D | Bounds, Branch, or Error? |
60.0 | D | Bounds, Branch, or Error? |
59.99899 | F | Bounds, Branch, or Error? |
35.0 | F | Bounds, Branch, or Error? |
-92.0 | F | Bounds, Branch, or Error? |
Here is a discussion about how to correcty identify the inidividual test cases listed above.