3 ms·
function (int i) { return 1 / i; } 100% coverage means nothing here when i = 0.
by windows2020 5y ago
function (int i) {
return 1 / i;
}
100% coverage means nothing here when i = 0.
- windows2020 5y agoFurthermore, a line of code is arbitrary, and so is this metric.
- amw-zero 5y agoWell, coverage can still tell you that this line is not covered at all. The absence of coverage is a signal, but the presence of it is not sufficient to prove that the code works for all inputs. We’ve also known this since forever, this has always been Djikstra’s message to software developers.
- imcotton 5y ago100% coverage is baseline, not the ceiling.
- xxs 5y agokind of a bad function, though - can return -1, 0 and 1 only - plus the integer division by zero, unless 1 is a float type then 0 is positive infinite which is good.