3 ms·
Well, the number of case combinations that can occur can be exponential in the code size, whereas coverage is linear. Say we have a sequence of five one-branc
by kazinator 5y ago
Well, the number of case combinations that can occur can be exponential in the code size, whereas coverage is linear.
Say we have a sequence of five one-branch if statements: if (cond_i) { do_stuff_i } for i from 0 to 4. We can get complete coverage by executing that sequence just once with all conditions being true. But there are 32 distinct pathways through it, which could have all sorts of bugs.
Coverage also doesn't test for correctness at all; suppose that the one case that hits 100% coverage by executing every do_stuff_i produces the wrong result for that case. 100% coverage was still achieved.
A test suite consisting of nothing but a coverage test is ineffective in doing anything other than showing that the software doesn't bomb or infinite loop.