Add 02/22

This commit is contained in:
Lorenzo 2022-12-30 14:35:46 +01:00
parent 45a8cbaefc
commit 517e1ae071
36 changed files with 301 additions and 0 deletions

View file

@ -0,0 +1 @@
100%

View file

@ -0,0 +1,52 @@
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 il seguente programma C:
-----------
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define N 1 /* number of test cases */
int f(int x)  { int y = 0;
  LOOP: if (abs(x) - y <= 2)
{return Sì ;}
else {y = y + 1; goto LOOP;}
} /* f() */
int main() {  int i, y; int x[N];
// define test cases
x[0] = 3; 
// testing
for (i = 0; i < N; i++) {
y = f(x[i]); // function under testing
assert(y == (abs(x[i]) <= 2) ? 0 : (abs(x[i]) - 2)); // oracle
}
printf("All %d test cases passed\n", N);
return (0); 
}
-----------
Il programma main() sopra realizza il nostro testing per la funzione f(). I test cases sono i valori in x1[i] ed x2[i].
Quale delle seguenti è la branch coverage conseguita?

View file

@ -0,0 +1 @@
50%

View file

@ -0,0 +1 @@
80%