diff --git a/Ingegneria del Software/0121_34/correct.txt b/Ingegneria del Software/0121_34/correct.txt new file mode 100644 index 0000000..95bc750 --- /dev/null +++ b/Ingegneria del Software/0121_34/correct.txt @@ -0,0 +1 @@ +100% \ No newline at end of file diff --git a/Ingegneria del Software/0121_34/quest.txt b/Ingegneria del Software/0121_34/quest.txt new file mode 100644 index 0000000..6dbca93 --- /dev/null +++ b/Ingegneria del Software/0121_34/quest.txt @@ -0,0 +1,53 @@ +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 + +#include + +#include + +#define N 4 /* number of test cases */ + + +int f(int x1, int x2) + +{ + if (x1 + x2 <= 2) + + return (1); + + else return (2); + +} + + +int main() { int i, y; int x1[N], x2[N]; + + // define test cases + + x1[0] = 3; x2[0] = -2; x1[1] = 4; x2[1] = -3; x1[2] = 7; x2[2] = -4; x1[3] = 8; x2[3] = -5;  + + // testing + + for (i = 0; i < N; i++) { + + y = f(x1[i], x2[i]); // function under testing + + assert(y ==(x1[i], x2[i] <= 2) ? 1 : 2); // oracle + + } + + printf("All %d test cases passed\n", N); + + return (0);    + +} +----------- + +Il programma main() sopra realizza il nostro testing per la funzione f1(). I test cases sono i valori in x1[i] ed x2[i]. + +Quale delle seguenti è la branch coverage conseguita? \ No newline at end of file diff --git a/Ingegneria del Software/0121_34/wrong1.txt b/Ingegneria del Software/0121_34/wrong1.txt new file mode 100644 index 0000000..23e721f --- /dev/null +++ b/Ingegneria del Software/0121_34/wrong1.txt @@ -0,0 +1 @@ +50% \ No newline at end of file diff --git a/Ingegneria del Software/0121_34/wrong2.txt b/Ingegneria del Software/0121_34/wrong2.txt new file mode 100644 index 0000000..a2507e5 --- /dev/null +++ b/Ingegneria del Software/0121_34/wrong2.txt @@ -0,0 +1 @@ +80% \ No newline at end of file