Here is the structure and complexity of a complete solution to the TDD project:
The cyclomatic complexity of the code can be measured using the formula of the number of simple conditions + 1. Each new TDD rule would add a simple condition, typically to a new if-statement. Note that the depth does not exceed 1 and that no if-then-else's are needed; therefore, no nested if-statements.
Tests | if-stmts | Complexity | Rule if-stmts | Error if-stmts | Commits | Rule Oracle | Error Oracle | SLOC | Depth |
---|---|---|---|---|---|---|---|---|---|
2 | 18 | 39 | 16 | 2 | 21 | 0 | 0 | 68 | 1 |
14 | 15 | 39 | 13 | 2 | 21 | 13 | 2 | 37 | 1 |
13 | 19 | 32 | 15 | 4 | 19 | 12 | 8 | 66 | 3 |
14 | 13 | 32 | 13 | 0 | 17 | 13 | 0 | 36 | 1 |
13 | 12 | 30 | 12 | 0 | 21 | 8 | 0 | 29 | 1 |
13 | 13 | 29 | 13 | 0 | 16 | 12 | 0 | 44 | 1 |
11 | 11 | 27 | 11 | 0 | 18 | 0 | 0 | 38 | 1 |
16 | 19 | 26 | 16 | 3 | 20 | 12 | 8 | 57 | 2 |
16 | 14 | 26 | 11 | 3 | 18 | 12 | 8 | 52 | 2 |
13 | 17 | 24 | 14 | 3 | 17 | 7 | 1 | 64 | 3 |
11 | 11 | 24 | 11 | 0 | 13 | 10 | 0 | 40 | 1 |
13 | 11 | 24 | 11 | 0 | 16 | 10 | 0 | 41 | 1 |
14 | 11 | 24 | 11 | 0 | 21 | 13 | 0 | 48 | 1 |
14 | 11 | 24 | 11 | 0 | 24 | 13 | 0 | 52 | 1 |
13 | 14 | 23 | 14 | 0 | 16 | 12 | 0 | 45 | 2 |
11 | 13 | 23 | 12 | 1 | 14 | 9 | 0 | 46 | 2 |
10 | 11 | 23 | 11 | 0 | 14 | 7 | 0 | 40 | 1 |
11 | 11 | 23 | 11 | 0 | 14 | 9 | 0 | 38 | 1 |
18 | 21 | 22 | 18 | 3 | 18 | 9 | 6 | 98 | 3 |
13 | 14 | 22 | 14 | 0 | 15 | 7 | 0 | 63 | 2 |
14 | 11 | 21 | 11 | 0 | 20 | 11 | 0 | 28 | 1 |
14 | 17 | 19 | 17 | 0 | 16 | 13 | 0 | 79 | 3 |
14 | 15 | 19 | 15 | 0 | 18 | 11 | 0 | 40 | 1 |
16 | 15 | 18 | 13 | 2 | 24 | 13 | 3 | 39 | 1 |
13 | 15 | 17 | 15 | 0 | 19 | 4 | 0 | 37 | 1 |
1 | 11 | 17 | 11 | 0 | 18 | 12 | 0 | 29 | 1 |
14 | 12 | 16 | 12 | 0 | 17 | 13 | 0 | 48 | 3 |
9 | 10 | 15 | 10 | 0 | 12 | 5 | 0 | 32 | 1 |
13 | 12 | 14 | 12 | 0 | 18 | 13 | 0 | 45 | 1 |
12 | 11 | 12 | 11 | 0 | 20 | 13 | 0 | 42 | 2 |
14 | 10 | 12 | 10 | 0 | 26 | 13 | 0 | 30 | 1 |
7 | 6 | 8 | 5 | 1 | 11 | 6 | 5 | 31 | 1 |
5 | 4 | 6 | 4 | 0 | 7 | 5 | 0 | 22 | 1 |
The cyclomatic complexity, i.e., the number of simple conditions + 1, is the minimum number of test cases needed to ensure that all statements in the code are executed using the test suite. For a cyclomatic complexity of 39, this would take 39 test cases; for a cyclomatic complexity of 11, this would take 11 test cases. This is almost 4 times the amount of tests needed.e