2022-11-06 17:27:39 +01:00
|
|
|
Il branch coverage di un insieme di test cases è la percentuale di branch del programma che sono attraversati da almeno un test case.
|
|
|
|
|
|
|
|
Si consideri la seguente funzione C:
|
|
|
|
|
|
|
|
-----------
|
2022-11-14 17:34:01 +01:00
|
|
|
<pre>
|
2022-11-06 17:27:39 +01:00
|
|
|
int f(int x, int y) {
|
|
|
|
|
|
|
|
if (x - y - 2 <= 0) { if (x + y - 1 >= 0) return (1); else return (2); }
|
|
|
|
|
|
|
|
else {if (x + 2*y - 5 >= 0) return (3); else return (4); }
|
|
|
|
|
|
|
|
} /* f() */
|
|
|
|
</pre>
|
|
|
|
Si considerino i seguenti test cases: {x=1, y=2}, {x=0, y=0}, {x=5, y=0}, {x=3, y=0}.
|
|
|
|
|
|
|
|
Quale delle seguenti è la branch coverage conseguita?
|