mirror of
https://github.com/appinfosapienza/so-un-bot.git
synced 2025-03-14 05:05:22 +01:00
commit
9c7b4e10a5
40 changed files with 357 additions and 0 deletions
1
Ingegneria del Software/0121_34/correct.txt
Normal file
1
Ingegneria del Software/0121_34/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
100%
|
53
Ingegneria del Software/0121_34/quest.txt
Normal file
53
Ingegneria del Software/0121_34/quest.txt
Normal file
|
@ -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 <stdio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#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?
|
1
Ingegneria del Software/0121_34/wrong1.txt
Normal file
1
Ingegneria del Software/0121_34/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
50%
|
1
Ingegneria del Software/0121_34/wrong2.txt
Normal file
1
Ingegneria del Software/0121_34/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_24/correct.txt
Normal file
1
Ingegneria del Software/0222_24/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
90%
|
12
Ingegneria del Software/0222_24/quest.txt
Normal file
12
Ingegneria del Software/0222_24/quest.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
img=https://i.imgur.com/6m6ALRb.png
|
||||
La state coverage di un insieme di test cases (cioè sequeze di inputs) per uno state diagram è la percentuale di stati (inclusi START ed END) rggiunti almeno una volta.
|
||||
|
||||
Si consideri lo state diagram in figura
|
||||
ed il seguente insieme di test cases:
|
||||
|
||||
1) Start PIN validation, card inserted, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2
|
||||
|
||||
2) Start PIN validation, card inserted, PIN Entered, Cancel 2, End PIN Validation 2
|
||||
|
||||
|
||||
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0222_24/wrong1.txt
Normal file
1
Ingegneria del Software/0222_24/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_24/wrong2.txt
Normal file
1
Ingegneria del Software/0222_24/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
60%
|
1
Ingegneria del Software/0222_27/correct.txt
Normal file
1
Ingegneria del Software/0222_27/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
90%
|
13
Ingegneria del Software/0222_27/quest.txt
Normal file
13
Ingegneria del Software/0222_27/quest.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
img=https://i.imgur.com/6m6ALRb.png
|
||||
La state coverage di un insieme di test cases (cioè sequeze di inputs) per uno state diagram è la percentuale di stati (inclusi START ed END) rggiunti almeno una volta.
|
||||
|
||||
Si consideri lo state diagram in figura ed il seguente insieme di test cases:
|
||||
|
||||
1) Start PIN validation, card inserted, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2;
|
||||
|
||||
2) Start PIN validation, card inserted, PIN Entered, Invalid PIN, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2;
|
||||
|
||||
3) Start PIN validation, card inserted, PIN Entered, Invalid PIN, PIN Entered, Invalid PIN, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2.
|
||||
|
||||
|
||||
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0222_27/wrong1.txt
Normal file
1
Ingegneria del Software/0222_27/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_27/wrong2.txt
Normal file
1
Ingegneria del Software/0222_27/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
60%
|
1
Ingegneria del Software/0222_33/correct.txt
Normal file
1
Ingegneria del Software/0222_33/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
60%
|
45
Ingegneria del Software/0222_33/quest.txt
Normal file
45
Ingegneria del Software/0222_33/quest.txt
Normal file
|
@ -0,0 +1,45 @@
|
|||
Il partition coverage di un insieme di test cases è la percentuale di elementi della partition inclusi nei test cases. La partition è una partizione finita dell'insieme di input della funzione che si sta testando.
|
||||
|
||||
Si consideri il seguente programma C:
|
||||
|
||||
-----------
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define N 5 /* number of test cases */
|
||||
|
||||
int f1(int x) { return (2*x); }
|
||||
|
||||
int main() { int i, y; int x[N];
|
||||
|
||||
// define test cases
|
||||
|
||||
x[0] = 0; x[1] = 1; x[2] = -1; x[3] = 10; x[4] = -10;
|
||||
|
||||
// testing
|
||||
|
||||
for (i = 0; i < N; i++) {
|
||||
|
||||
y = f1(x[i]); // function under testing
|
||||
|
||||
assert(y == 2*x[i]); // oracle
|
||||
|
||||
}
|
||||
|
||||
printf("All %d test cases passed\n", N);
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
Si vuole testare la funzione f1(). A tal fine l'insieme degli interi viene partizionato come segue:
|
||||
|
||||
{(-inf, -21], [-20, -1], {0}, [1, 20], [21, +inf)}
|
||||
|
||||
Il programma main() sopra realizza il nostro testing per la funzione f1(). I test cases sono i valori in x[i].
|
||||
|
||||
Quale delle seguenti è la partition coverage conseguita?
|
1
Ingegneria del Software/0222_33/wrong1.txt
Normal file
1
Ingegneria del Software/0222_33/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_33/wrong2.txt
Normal file
1
Ingegneria del Software/0222_33/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
100%
|
1
Ingegneria del Software/0222_35/correct.txt
Normal file
1
Ingegneria del Software/0222_35/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
100%
|
52
Ingegneria del Software/0222_35/quest.txt
Normal file
52
Ingegneria del Software/0222_35/quest.txt
Normal 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?
|
1
Ingegneria del Software/0222_35/wrong1.txt
Normal file
1
Ingegneria del Software/0222_35/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
50%
|
1
Ingegneria del Software/0222_35/wrong2.txt
Normal file
1
Ingegneria del Software/0222_35/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_39/correct.txt
Normal file
1
Ingegneria del Software/0222_39/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
50%
|
55
Ingegneria del Software/0222_39/quest.txt
Normal file
55
Ingegneria del Software/0222_39/quest.txt
Normal file
|
@ -0,0 +1,55 @@
|
|||
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 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] = 5; x2[2] = -4; x1[3] = 6; 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?
|
1
Ingegneria del Software/0222_39/wrong1.txt
Normal file
1
Ingegneria del Software/0222_39/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_39/wrong2.txt
Normal file
1
Ingegneria del Software/0222_39/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
100%
|
1
Ingegneria del Software/0222_41/correct.txt
Normal file
1
Ingegneria del Software/0222_41/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
100%
|
55
Ingegneria del Software/0222_41/quest.txt
Normal file
55
Ingegneria del Software/0222_41/quest.txt
Normal file
|
@ -0,0 +1,55 @@
|
|||
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 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?
|
1
Ingegneria del Software/0222_41/wrong1.txt
Normal file
1
Ingegneria del Software/0222_41/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
50%
|
1
Ingegneria del Software/0222_41/wrong2.txt
Normal file
1
Ingegneria del Software/0222_41/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_5/correct.txt
Normal file
1
Ingegneria del Software/0222_5/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
60%
|
15
Ingegneria del Software/0222_5/quest.txt
Normal file
15
Ingegneria del Software/0222_5/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
img=https://i.imgur.com/6m6ALRb.png
|
||||
La transition coverage di un insieme di test cases (cioè sequeze di inputs) per uno state diagram è la percentuale di transizioni (archi nel grafo dello state diagram) percorsi almeno una volta.
|
||||
|
||||
Si consideri lo state diagram in figura
|
||||
|
||||
ed il seguente insieme di test cases:
|
||||
|
||||
1) Start PIN validation, card inserted, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2;
|
||||
|
||||
2) Start PIN validation, card inserted, PIN Entered, Invalid PIN, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2;
|
||||
|
||||
3) Start PIN validation, card inserted, PIN Entered, Invalid PIN, PIN Entered, Invalid PIN, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2.
|
||||
|
||||
|
||||
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0222_5/wrong1.txt
Normal file
1
Ingegneria del Software/0222_5/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_5/wrong2.txt
Normal file
1
Ingegneria del Software/0222_5/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
40%
|
1
Ingegneria del Software/0222_50/correct.txt
Normal file
1
Ingegneria del Software/0222_50/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
90%
|
14
Ingegneria del Software/0222_50/quest.txt
Normal file
14
Ingegneria del Software/0222_50/quest.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
img=https://i.imgur.com/6m6ALRb.png
|
||||
La transition coverage di un insieme di test cases (cioè sequeze di inputs) per uno state diagram è la percentuale di transizioni (archi nel grafo dello state diagram) percorsi almeno una volta.
|
||||
|
||||
Si consideri lo state diagram in figura ed il seguente insieme di test cases:
|
||||
|
||||
|
||||
1) Start PIN validation, card inserted, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2
|
||||
|
||||
2) Start PIN validation, card inserted, PIN Entered, Valid PIN, Cancel 2, End PIN Validation 2
|
||||
|
||||
3) Start PIN validation, card inserted, PIN Entered, Invalid PIN, PIN Entered, Invalid PIN, PIN Entered, Invalid PIN, PIN Entered, Invalid PIN, More than 3 failed..., END PIN validation 1;
|
||||
|
||||
|
||||
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0222_50/wrong1.txt
Normal file
1
Ingegneria del Software/0222_50/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
100%
|
1
Ingegneria del Software/0222_50/wrong2.txt
Normal file
1
Ingegneria del Software/0222_50/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
1
Ingegneria del Software/0222_7/correct.txt
Normal file
1
Ingegneria del Software/0222_7/correct.txt
Normal file
|
@ -0,0 +1 @@
|
|||
60%
|
13
Ingegneria del Software/0222_7/quest.txt
Normal file
13
Ingegneria del Software/0222_7/quest.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
img=https://i.imgur.com/6m6ALRb.png
|
||||
La transition coverage di un insieme di test cases (cioè sequeze di inputs) per uno state diagram è la percentuale di transizioni (archi nel grafo dello state diagram) percorsi almeno una volta.
|
||||
|
||||
Si consideri lo state diagram in figura
|
||||
|
||||
ed il seguente insieme di test cases:
|
||||
|
||||
1) Start PIN validation, card inserted, PIN Entered, Valid PIN, Cancel 3, End PIN Validation 2
|
||||
|
||||
2) Start PIN validation, card inserted, PIN Entered, Cancel 2, End PIN Validation 2
|
||||
|
||||
|
||||
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0222_7/wrong1.txt
Normal file
1
Ingegneria del Software/0222_7/wrong1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
40%
|
1
Ingegneria del Software/0222_7/wrong2.txt
Normal file
1
Ingegneria del Software/0222_7/wrong2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
80%
|
Loading…
Reference in a new issue