This project was designed with TDD .
If we want to balance the effort and confidence, how many tests we need to make for Notary judge method ? please have a look at three ways below, and I believe you will get the answer by yourself.
- Exhaustive, so that we need to have 15 tests, because 3A1B is not exist.
- Edge + Normal, so that we need 0A4B, 4A0B, 0A0B, 2A2B, so the number is 4
- Orthogonal decomposition, which looks like below, and what we can see is there are 6 tests we need to cover
Position\Number | Totally Equal | Partially Equal | Totally not Equal |
---|---|---|---|
Totally Equal | 4A0B | NOT EXIST | NOT EXIST |
Partially Equal | 2A2B | 2A0B | NOT EXIST |
Totally not Equal | 0A4B | 0A2B | 0A0B |
The requirement is we can generate a string which contains 4 different number in the range 1 - 9.
It seems it's impossible to test a random string, but we can find some key words to test.
- the number in the string is different
- the string length is 4
- the number in the range 1 - 9
There are 6 lives by default for each round, so we need to cover stages blow:
- get the right answer at the first time
- run out of lives
- got lives to continue