In this technique, we do not use the code to determine a test suite; rather, knowing the problem that we're trying to solve, we come up with four types of test data:
We can come up with test data for each of the four cases, based on values of the polynomial's discriminant (b2-4ac):
Easy data (discriminant is a perfect square):
| a | b | c | Roots |
| 1 | 2 | 1 | -1, -1 |
| 1 | 3 | 2 | -1, -2 |
Typical data (discriminant is positive):
| a | b | c | Roots |
| 1 | 4 | 1 | -3.73205, -0.267949 |
| 2 | 4 | 1 | -1.70711, -0.292893 |
Boundary / extreme data (discriminant is zero):
| a | b | c | Roots |
| 2 | -4 | 2 | 1, 1 |
| 2 | -8 | 8 | 2, 2 |
Bogus data (discriminant is negative, or a is zero):
| a | b | c | Roots |
| 1 | 1 | 1 | square root of negative number |
| 0 | 1 | 1 | division by zero |
As with glass-box testing, you should test your code with each set of test data. If the answers match, then your code passes the black-box test.