1 · The explosion
3 conditions
At k = 1 and k = 2 all three agree, which is exactly why the shortcut looks correct. Push past 2 and watch path coverage detonate while MC/DC barely moves.
Engineering Method
Every if multiplies the ways code can behave. So how many tests do you
actually need? Everything below is built from one thing: a unit,
a single branch of a decision. It is a row in a table, a test in the suite, and a pip on
this page, all the same object. It wears one of four states, everywhere.
At k = 1 and k = 2 all three agree, which is exactly why the shortcut looks correct. Push past 2 and watch path coverage detonate while MC/DC barely moves.
Required tests found: 0 / 3 · MC/DC complete, this method is a 1
if ( && )
// then: happy path
else
// else: sad path Toggle c1 and c2 to visit every reachable row.
| c1 | c2 | Outcome | Role |
|---|---|---|---|
| T | T | then | Happy path |
| F | T | else | Flip c1 |
| T | F | else | Flip c2 |
| F | F | else | Redundant |
A branch a unit test cannot reach does not disappear. It bubbles up to the level that can verify it, and stays documented there.