mirror of
https://github.com/appinfosapienza/so-un-bot.git
synced 2025-03-14 12:46:15 +01:00
ingsw: Add 07-22
This commit is contained in:
parent
9c7b4e10a5
commit
3b6c7b4377
104 changed files with 520 additions and 0 deletions
1
Ingegneria del Software/0722_1/correct.txt
Normal file
1
Ingegneria del Software/0722_1/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 100%
|
19
Ingegneria del Software/0722_1/quest.txt
Normal file
19
Ingegneria del Software/0722_1/quest.txt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
img=https://i.imgur.com/HZd8X10.png
|
||||||
|
La state coverage di un insieme di test cases (cioè sequenze di inputs) per uno state diagram è la percentuale di stati (inclusi START ed END) raggiunti almeno una volta.
|
||||||
|
|
||||||
|
Si consideri lo state diagram in figura
|
||||||
|
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Test case 1: act0 act0 act2 act0 act0 act0 act2 act1 act2 act0 act2 act2 act2 act2 act0 act0 act1 act2 act2 act0 act2 act0 act2 act1 act0 act2 act1 act2 act2 act0 act2
|
||||||
|
|
||||||
|
Test case 2: act2 act2 act1 act0 act0 act0 act0 act2 act2 act1 act2
|
||||||
|
|
||||||
|
Test case 3: act2 act2 act2 act1 act0 act2 act2 act0 act2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0722_1/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_1/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 60%
|
1
Ingegneria del Software/0722_1/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_1/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 80%
|
1
Ingegneria del Software/0722_10/correct.txt
Normal file
1
Ingegneria del Software/0722_10/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
50%
|
20
Ingegneria del Software/0722_10/quest.txt
Normal file
20
Ingegneria del Software/0722_10/quest.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
img=https://i.imgur.com/pz1HiRX.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Test case 1: act2 act2
|
||||||
|
|
||||||
|
Test case 2: act0 act1 act1 act1 act2 act2 act1 act0 act1
|
||||||
|
|
||||||
|
Test case 3: act0 act0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?
|
1
Ingegneria del Software/0722_10/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_10/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
70%
|
1
Ingegneria del Software/0722_10/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_10/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
90%
|
1
Ingegneria del Software/0722_11/correct.txt
Normal file
1
Ingegneria del Software/0722_11/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(a = 6, b = 0, c = 1), (a = 0, b = 5, c = 0), (a = 0, b = 3, c = 0)
|
22
Ingegneria del Software/0722_11/quest.txt
Normal file
22
Ingegneria del Software/0722_11/quest.txt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
Una Condition è una proposizione booleana, cioè una espressione con valore booleano che non può essere decomposta
|
||||||
|
in espressioni boolean più semplici. Ad esempio, (x + y <= 3) è una condition.
|
||||||
|
|
||||||
|
Una Decision è una espressione booleana composta da conditions e zero o più operatori booleani. Ad esempio, sono decisions:
|
||||||
|
(x + y <= 3)
|
||||||
|
((x + y <= 3) || (x - y > 7))
|
||||||
|
Un insieme di test cases T soddisfa il criterio di Condition/Decision coverage se tutte le seguenti condizioni sono soddisfatte:
|
||||||
|
|
||||||
|
1) Ciascun punto di entrata ed uscita nel programma è eseguito in almeno un test;
|
||||||
|
2) Per ogni decision d nel programma, per ogni condition c in d, esiste un test in T in cui c è true ed un test in T in cui c è false.
|
||||||
|
3) Per ogni decision d nel programma, esiste un test in T in cui d è true ed un test in T in cui d è false.
|
||||||
|
|
||||||
|
Si consideri la seguente funzione:
|
||||||
|
int f(int a, int b, int c)
|
||||||
|
{ if ( (a + b >= 6) && (b - c <= 1) )
|
||||||
|
return (1); // punto di uscita 1
|
||||||
|
else if ((b - c <= 1) || (b + c >= 5))
|
||||||
|
then return (2); // punto di uscita 2
|
||||||
|
else return (3); // punto di uscita 3
|
||||||
|
}
|
||||||
|
|
||||||
|
Quale dei seguenti test set soddisfa il criterio della Condition/Decision coverage ?
|
1
Ingegneria del Software/0722_11/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_11/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(a = 6, b = 0, c = 1), (a = 0, b = 5, c = 0), (a = 0, b = 3, c = 2)
|
1
Ingegneria del Software/0722_11/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_11/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(a = 5, b = 0, c = 1), (a = 0, b = 5, c = 0), (a = 0, b = 3, c = 0)
|
1
Ingegneria del Software/0722_12/correct.txt
Normal file
1
Ingegneria del Software/0722_12/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{x = -200, x = -50, x = 0, x = 100, x = 700}
|
11
Ingegneria del Software/0722_12/quest.txt
Normal file
11
Ingegneria del Software/0722_12/quest.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
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 la seguente funzione C:
|
||||||
|
|
||||||
|
int f1(int x) { return (x + 7); }
|
||||||
|
|
||||||
|
Si vuole testare la funzione f1(). A tal fine l'insieme degli interi viene partizionato come segue:
|
||||||
|
|
||||||
|
{(-inf, -101], [-100, -1], {0}, [1, 500], [501, +inf)}
|
||||||
|
|
||||||
|
Quale dei seguenti test cases consegue una partition coverage del 100% ?
|
1
Ingegneria del Software/0722_12/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_12/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{x = -200, x = -150, x = 0, x = 100, x = 700}
|
1
Ingegneria del Software/0722_12/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_12/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{x = -200, x = -50, x = 0, x = 100, x = 500}
|
1
Ingegneria del Software/0722_13/correct.txt
Normal file
1
Ingegneria del Software/0722_13/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 40%
|
15
Ingegneria del Software/0722_13/quest.txt
Normal file
15
Ingegneria del Software/0722_13/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
img=https://i.imgur.com/dMvnEEi.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
Test case 1: act2 act2 act2 act0
|
||||||
|
|
||||||
|
Test case 2: act0 act1 act2 act0 act2
|
||||||
|
|
||||||
|
Test case 3: act2 act2 act2 act2
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?
|
1
Ingegneria del Software/0722_13/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_13/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 100%
|
1
Ingegneria del Software/0722_13/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_13/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 70%
|
1
Ingegneria del Software/0722_14/correct.txt
Normal file
1
Ingegneria del Software/0722_14/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
100%
|
17
Ingegneria del Software/0722_14/quest.txt
Normal file
17
Ingegneria del Software/0722_14/quest.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
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:
|
||||||
|
|
||||||
|
-----------
|
||||||
|
|
||||||
|
int f(int x, int y) {
|
||||||
|
|
||||||
|
if (x - y <= 2) { if (x + y >= 1) return (1); else return (2); }
|
||||||
|
|
||||||
|
else {if (x + 2*y >= 5) return (3); else return (4); }
|
||||||
|
|
||||||
|
} /* f() */
|
||||||
|
|
||||||
|
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?
|
1
Ingegneria del Software/0722_14/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_14/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
80%
|
1
Ingegneria del Software/0722_14/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_14/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
50%
|
1
Ingegneria del Software/0722_15/correct.txt
Normal file
1
Ingegneria del Software/0722_15/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 75%
|
16
Ingegneria del Software/0722_15/quest.txt
Normal file
16
Ingegneria del Software/0722_15/quest.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
img=https://i.imgur.com/wYIAk1e.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) raggiunti almeno una volta.
|
||||||
|
|
||||||
|
Si consideri lo state diagram in figura
|
||||||
|
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
Test case 1: act1 act0 act2 act0
|
||||||
|
|
||||||
|
Test case 2: act0 act1 act2 act2 act0
|
||||||
|
|
||||||
|
|
||||||
|
Test case 3: act0 act0 act0
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0722_15/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_15/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 100%
|
1
Ingegneria del Software/0722_15/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_15/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 80%
|
1
Ingegneria del Software/0722_16/correct.txt
Normal file
1
Ingegneria del Software/0722_16/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
100%
|
17
Ingegneria del Software/0722_16/quest.txt
Normal file
17
Ingegneria del Software/0722_16/quest.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
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:
|
||||||
|
|
||||||
|
-----------
|
||||||
|
|
||||||
|
int f(int x, int y) {
|
||||||
|
|
||||||
|
if (x - y <= 0) { if (x + y >= 2) return (1); else return (2); }
|
||||||
|
|
||||||
|
else {if (2*x + y >= 1) return (3); else return (4); }
|
||||||
|
|
||||||
|
} /* f() */
|
||||||
|
|
||||||
|
Si considerino i seguenti test cases: {x=1, y=1}, {x=0, y=0}, {x=1, y=0}, {x=0, y=-1}.
|
||||||
|
|
||||||
|
Quale delle seguenti è la branch coverage conseguita?
|
1
Ingegneria del Software/0722_16/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_16/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
50%
|
1
Ingegneria del Software/0722_16/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_16/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
80%
|
1
Ingegneria del Software/0722_17/correct.txt
Normal file
1
Ingegneria del Software/0722_17/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
80%
|
16
Ingegneria del Software/0722_17/quest.txt
Normal file
16
Ingegneria del Software/0722_17/quest.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
img=https://i.imgur.com/ixzrFpG.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
Test case 1: act1 act1 act1
|
||||||
|
|
||||||
|
Test case 2: act1 act2 act1 act1 act0 act0 act0 act1 act2 act1 act2 act1 act2 act2 act0 act2 act0 act1 act2 act2 act0 act2 act2 act2
|
||||||
|
|
||||||
|
Test case 3: act0 act1 act1 act0 act2 act2 act0 act2 act0 act2 act0 act2 act0 act0 act0 act0 act0 act0 act1 act1 act2
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?
|
1
Ingegneria del Software/0722_17/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_17/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
60%
|
1
Ingegneria del Software/0722_17/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_17/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
100%
|
1
Ingegneria del Software/0722_18/correct.txt
Normal file
1
Ingegneria del Software/0722_18/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 100%
|
16
Ingegneria del Software/0722_18/quest.txt
Normal file
16
Ingegneria del Software/0722_18/quest.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
img=https://i.imgur.com/a7JeI7m.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) raggiunti almeno una volta.
|
||||||
|
|
||||||
|
Si consideri lo state diagram in figura
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
Test case 1: act1 act2 act2 act2 act2 act0 act2
|
||||||
|
|
||||||
|
Test case 2: act2 act0 act0 act2 act0
|
||||||
|
|
||||||
|
Test case 3: act2 act2 act0 act2 act2 act0
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0722_18/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_18/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 90%
|
1
Ingegneria del Software/0722_18/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_18/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 80%
|
1
Ingegneria del Software/0722_19/correct.txt
Normal file
1
Ingegneria del Software/0722_19/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 50%
|
17
Ingegneria del Software/0722_19/quest.txt
Normal file
17
Ingegneria del Software/0722_19/quest.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
img=https://i.imgur.com/Rd4gO4k.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
Test case 1: act0 act2 act1 act2
|
||||||
|
|
||||||
|
Test case 2: act2 act2 act1 act2 act2
|
||||||
|
|
||||||
|
|
||||||
|
Test case 3: act2 act1 act0 act2
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?
|
1
Ingegneria del Software/0722_19/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_19/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 100%
|
1
Ingegneria del Software/0722_19/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_19/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 80%
|
5
Ingegneria del Software/0722_2/correct.txt
Normal file
5
Ingegneria del Software/0722_2/correct.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
int f(in x, int y)
|
||||||
|
{
|
||||||
|
assert( (x > 0) && (y > 0) && ((x > 1) || (y > 1)) );
|
||||||
|
.....
|
||||||
|
}
|
7
Ingegneria del Software/0722_2/quest.txt
Normal file
7
Ingegneria del Software/0722_2/quest.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Pre-condizioni, invarianti e post-condizioni di un programma possono essere definiti usando la macro del C assert() (in <assert.h>). In particolare, assert(expre) non fa nulla se l'espressione expre vale TRUE (cioè non è 0), stampa un messaggio di errore su stderr e abortisce l'esecuzione del programma altrimenti.
|
||||||
|
|
||||||
|
Si consideri la funzione C
|
||||||
|
|
||||||
|
int f(in x, int y) { ..... }
|
||||||
|
|
||||||
|
Quale delle seguenti assert esprime la pre-condizione che entrambi gli argomenti di f sono positivi ed almeno uno di loro è maggiore di 1 ?
|
5
Ingegneria del Software/0722_2/wrong 1.txt
Normal file
5
Ingegneria del Software/0722_2/wrong 1.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
int f(in x, int y)
|
||||||
|
{
|
||||||
|
assert( (x >= 0) && (y >= 0) && ((x > 1) || (y > 1)) );
|
||||||
|
.....
|
||||||
|
}
|
5
Ingegneria del Software/0722_2/wrong 2.txt
Normal file
5
Ingegneria del Software/0722_2/wrong 2.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
int f(in x, int y)
|
||||||
|
{
|
||||||
|
assert( (x > 0) && (y > 0) && (x > 1) && (y > 1) );
|
||||||
|
.....
|
||||||
|
}
|
1
Ingegneria del Software/0722_20/correct.txt
Normal file
1
Ingegneria del Software/0722_20/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 75%
|
15
Ingegneria del Software/0722_20/quest.txt
Normal file
15
Ingegneria del Software/0722_20/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
img=https://i.imgur.com/dzwfqoB.png
|
||||||
|
La state coverage di un insieme di test cases (cioè sequenze di inputs) per uno state diagram è la percentuale di stati (inclusi START ed END) raggiunti almeno una volta.
|
||||||
|
|
||||||
|
Si consideri lo state diagram in figura
|
||||||
|
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
Test case 1: act0 act1 act2 act2 act2 act1 act1 act0 act0 act0 act0 act0 act1
|
||||||
|
|
||||||
|
Test case 2: act1
|
||||||
|
|
||||||
|
Test case 3: act0 act1 act2 act0 act2 act2 act2 act2 act0 act1
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0722_20/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_20/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 60%
|
1
Ingegneria del Software/0722_20/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_20/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 100%
|
1
Ingegneria del Software/0722_21/correct.txt
Normal file
1
Ingegneria del Software/0722_21/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 60%
|
20
Ingegneria del Software/0722_21/quest.txt
Normal file
20
Ingegneria del Software/0722_21/quest.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
img=https://i.imgur.com/wVYqOVj.png
|
||||||
|
La state coverage di un insieme di test cases (cioè sequenze di inputs) per uno state diagram è la percentuale di stati (inclusi START ed END) raggiunti almeno una volta.
|
||||||
|
|
||||||
|
Si consideri lo state diagram in figura
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Test case 1: act0 act2 act2 act1 act2 act1 act2 act0 act1
|
||||||
|
|
||||||
|
Test case 2: act0 act2 act0
|
||||||
|
|
||||||
|
Test case 3: act1 act1 act2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0722_21/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_21/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 90%
|
1
Ingegneria del Software/0722_21/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_21/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 40%
|
1
Ingegneria del Software/0722_22/correct.txt
Normal file
1
Ingegneria del Software/0722_22/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 90%
|
16
Ingegneria del Software/0722_22/quest.txt
Normal file
16
Ingegneria del Software/0722_22/quest.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
img=https://i.imgur.com/zkjv6a7.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) raggiunti almeno una volta.
|
||||||
|
|
||||||
|
Si consideri lo state diagram in figura
|
||||||
|
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
Test case 1: act2 act1 act2 act2 act1 act0 act1 act2 act2
|
||||||
|
|
||||||
|
Test case 2: act0 act0 act2
|
||||||
|
|
||||||
|
|
||||||
|
Test case 3: act2 act0 act2
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0722_22/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_22/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 70%
|
1
Ingegneria del Software/0722_22/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_22/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
State coverage: 100%
|
1
Ingegneria del Software/0722_23/correct.txt
Normal file
1
Ingegneria del Software/0722_23/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
60%
|
15
Ingegneria del Software/0722_23/quest.txt
Normal file
15
Ingegneria del Software/0722_23/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
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 la seguente funzione C:
|
||||||
|
|
||||||
|
int f1(int x) { return (2*x); }
|
||||||
|
|
||||||
|
Si vuole testare la funzione f1(). A tal fine l'insieme degli interi viene partizionato come segue:
|
||||||
|
|
||||||
|
{(-inf, -11], [-10, -1], {0}, [1, 50], [51, +inf)}
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
{x=-100, x= 40, x=100}
|
||||||
|
|
||||||
|
Quale delle seguenti è la partition coverage conseguita?
|
1
Ingegneria del Software/0722_23/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_23/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
100%
|
1
Ingegneria del Software/0722_23/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_23/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
80%
|
1
Ingegneria del Software/0722_24/correct.txt
Normal file
1
Ingegneria del Software/0722_24/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(a=200, b = 0, c = 1), (a=50, b = 5, c = 0), (a=50, b = 3, c = 0).
|
22
Ingegneria del Software/0722_24/quest.txt
Normal file
22
Ingegneria del Software/0722_24/quest.txt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
Una Condition è una proposizione booleana, cioè una espressione con valore booleano che non può essere decomposta
|
||||||
|
in espressioni boolean più semplici. Ad esempio, (x + y <= 3) è una condition.
|
||||||
|
|
||||||
|
Una Decision è una espressione booleana composta da conditions e zero o più operatori booleani. Ad esempio, sono decisions:
|
||||||
|
(x + y <= 3)
|
||||||
|
((x + y <= 3) || (x - y > 7))
|
||||||
|
Un insieme di test cases T soddisfa il criterio di Condition/Decision coverage se tutte le seguenti condizioni sono soddisfatte:
|
||||||
|
|
||||||
|
1) Ciascun punto di entrata ed uscita nel programma è eseguito in almeno un test;
|
||||||
|
2) Per ogni decision d nel programma, per ogni condition c in d, esiste un test in T in cui c è true ed un test in T in cui c è false.
|
||||||
|
3) Per ogni decision d nel programma, esiste un test in T in cui d è true ed un test in T in cui d è false.
|
||||||
|
|
||||||
|
Si consideri la seguente funzione:
|
||||||
|
int f(int a, int b, int c)
|
||||||
|
{ if ( (a >= 100) && (b - c <= 1) )
|
||||||
|
return (1); // punto di uscita 1
|
||||||
|
else if ((b - c <= 1) || (b + c >= 5)
|
||||||
|
)
|
||||||
|
then return (2); // punto di uscita 2
|
||||||
|
else return (3); // punto di uscita 3
|
||||||
|
}
|
||||||
|
Quale dei seguenti test set soddisfa il criterio della Condition/Decision coverage ?
|
1
Ingegneria del Software/0722_24/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_24/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(a=200, b = 0, c = 1), (a=50, b = 5, c = 0), (a=50, b = 0, c = 5).
|
1
Ingegneria del Software/0722_24/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_24/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(a=200, b = 0, c = 1), (a=50, b = 4, c = 0), (a=200, b = 4, c = 0)
|
9
Ingegneria del Software/0722_25/correct.txt
Normal file
9
Ingegneria del Software/0722_25/correct.txt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
int f(in x, int y)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
assert( (x >= 0) && (y >= 0) && ((x > 0) || (y > 0)) );
|
||||||
|
|
||||||
|
.....
|
||||||
|
|
||||||
|
}
|
7
Ingegneria del Software/0722_25/quest.txt
Normal file
7
Ingegneria del Software/0722_25/quest.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Pre-condizioni, invarianti e post-condizioni di un programma possono essere definiti usando la macro del C assert() (in <assert.h>). In particolare, assert(expre) non fa nulla se l'espressione expre vale TRUE (cioè non è 0), stampa un messaggio di errore su stderr e abortisce l'esecuzione del programma altrimenti.
|
||||||
|
|
||||||
|
Si consideri la funzione C
|
||||||
|
|
||||||
|
int f(in x, int y) { ..... }
|
||||||
|
|
||||||
|
Quale delle seguenti assert esprime la pre-condizione che entrambi gli argomenti di f sono non-negativi ed almeno uno di loro è positivo ?
|
9
Ingegneria del Software/0722_25/wrong 1.txt
Normal file
9
Ingegneria del Software/0722_25/wrong 1.txt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
int f(in x, int y)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
assert( (x > 0) && (y > 0) && ((x > 1) || (y > 1)) );
|
||||||
|
|
||||||
|
.....
|
||||||
|
|
||||||
|
}
|
9
Ingegneria del Software/0722_25/wrong 2.txt
Normal file
9
Ingegneria del Software/0722_25/wrong 2.txt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
int f(in x, int y)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
assert( (x >= 0) && (y >= 0) && ((x > 1) || (y > 1)) );
|
||||||
|
|
||||||
|
.....
|
||||||
|
|
||||||
|
}
|
1
Ingegneria del Software/0722_26/correct.txt
Normal file
1
Ingegneria del Software/0722_26/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Test set: {x=1, y=1}, {x=0, y=0}, {x=2, y=1}, {x=2, y=0}.
|
15
Ingegneria del Software/0722_26/quest.txt
Normal file
15
Ingegneria del Software/0722_26/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
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:
|
||||||
|
|
||||||
|
-----------
|
||||||
|
|
||||||
|
int f(int x, int y) {
|
||||||
|
|
||||||
|
if (x - y <= 0) { if (x + y >= 1) return (1); else return (2); }
|
||||||
|
|
||||||
|
else {if (2*x + y >= 5) return (3); else return (4); }
|
||||||
|
|
||||||
|
} /* f() */
|
||||||
|
|
||||||
|
Quale dei seguenti test sets consegue una branch coverage del 100% ?
|
1
Ingegneria del Software/0722_26/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_26/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Test set: {x=1, y=1}, {x=0, y=0}, {x=2, y=1}, {x=2, y=3}.
|
1
Ingegneria del Software/0722_26/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_26/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Test set: {x=1, y=1}, {x=2, y=2}, {x=2, y=1}, {x=2, y=0}.
|
1
Ingegneria del Software/0722_3/correct.txt
Normal file
1
Ingegneria del Software/0722_3/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
80%
|
15
Ingegneria del Software/0722_3/quest.txt
Normal file
15
Ingegneria del Software/0722_3/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
img=https://i.imgur.com/K7pm0xk.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
Test case 1: act0 act2 act1 act2 act2 act2 act0 act1 act2 act2 act2
|
||||||
|
|
||||||
|
Test case 2: act0 act1 act2 act2 act1 act2 act0 act2 act2 act2 act0
|
||||||
|
|
||||||
|
Test case 3: act2 act2 act0 act2 act1 act0 act2 act0
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?
|
1
Ingegneria del Software/0722_3/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_3/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
100%
|
1
Ingegneria del Software/0722_3/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_3/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
60%
|
1
Ingegneria del Software/0722_4/correct.txt
Normal file
1
Ingegneria del Software/0722_4/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
90%
|
15
Ingegneria del Software/0722_4/quest.txt
Normal file
15
Ingegneria del Software/0722_4/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
img=https://i.imgur.com/IAPlGNV.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) raggiunti almeno una volta.
|
||||||
|
|
||||||
|
Si consideri lo state diagram in figura
|
||||||
|
|
||||||
|
|
||||||
|
Si consideri il seguente insieme di test cases:
|
||||||
|
|
||||||
|
Test case 1: act1 act1 act0 act1 act1 act2 act0
|
||||||
|
|
||||||
|
Test case 2: act2 act0 act0
|
||||||
|
|
||||||
|
Test case 3: act1 act1 act2 act0 act0
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra
|
1
Ingegneria del Software/0722_4/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_4/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
70%
|
1
Ingegneria del Software/0722_4/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_4/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
100%
|
1
Ingegneria del Software/0722_5/correct.txt
Normal file
1
Ingegneria del Software/0722_5/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 70%
|
17
Ingegneria del Software/0722_5/quest.txt
Normal file
17
Ingegneria del Software/0722_5/quest.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
img=https://i.imgur.com/4nez8mZ.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
Test case 1: act2 act0 act2 act2 act2
|
||||||
|
|
||||||
|
Test case 2: act0 act2 act2 act1 act2 act1 act1 act1 act2 act2 act2 act2 act2
|
||||||
|
|
||||||
|
Test case 3: act2 act2 act2 act0 act1 act0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?
|
1
Ingegneria del Software/0722_5/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_5/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 60%
|
1
Ingegneria del Software/0722_5/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_5/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Transition coverage: 100%
|
1
Ingegneria del Software/0722_6/correct.txt
Normal file
1
Ingegneria del Software/0722_6/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
45%
|
13
Ingegneria del Software/0722_6/quest.txt
Normal file
13
Ingegneria del Software/0722_6/quest.txt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
img=https://i.imgur.com/gNFBVuc.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
Test case 1: act0 act1 act0 act2 act2 act1 act2 act2 act2 act2 act2 act0 act0
|
||||||
|
|
||||||
|
Test case 2: act2
|
||||||
|
|
||||||
|
Test case 3: act2
|
1
Ingegneria del Software/0722_6/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_6/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
60%
|
1
Ingegneria del Software/0722_6/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_6/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
90%
|
1
Ingegneria del Software/0722_7/correct.txt
Normal file
1
Ingegneria del Software/0722_7/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
40%
|
12
Ingegneria del Software/0722_7/quest.txt
Normal file
12
Ingegneria del Software/0722_7/quest.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
img=https://i.imgur.com/uEiyXTN.png
|
||||||
|
La transition coverage di un insieme di test cases (cioè sequenze 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:
|
||||||
|
|
||||||
|
Test case 1: act2 act2 act2 act2 act0 act1 act2 act0
|
||||||
|
|
||||||
|
Test case 2: act1 act2
|
||||||
|
|
||||||
|
Test case 3: act2 act0
|
1
Ingegneria del Software/0722_7/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_7/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
90%
|
1
Ingegneria del Software/0722_7/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_7/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
70%
|
1
Ingegneria del Software/0722_8/correct.txt
Normal file
1
Ingegneria del Software/0722_8/correct.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Test set: {x=3, y=6}, {x=0, y=0}, {x=15, y=0}, {x=9, y=0}.
|
15
Ingegneria del Software/0722_8/quest.txt
Normal file
15
Ingegneria del Software/0722_8/quest.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
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:
|
||||||
|
|
||||||
|
-----------
|
||||||
|
|
||||||
|
int f(int x, int y) {
|
||||||
|
|
||||||
|
if (x - y <= 6) { if (x + y >= 3) return (1); else return (2); }
|
||||||
|
|
||||||
|
else {if (x + 2*y >= 15) return (3); else return (4); }
|
||||||
|
|
||||||
|
} /* f() */
|
||||||
|
|
||||||
|
Quale dei seguenti test sets consegue una branch coverage del 100% ?
|
1
Ingegneria del Software/0722_8/wrong 1.txt
Normal file
1
Ingegneria del Software/0722_8/wrong 1.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Test set: {x=3, y=6}, {x=0, y=0}, {x=15, y=0}, {x=10, y=3}.
|
1
Ingegneria del Software/0722_8/wrong 2.txt
Normal file
1
Ingegneria del Software/0722_8/wrong 2.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Test set: {x=3, y=6}, {x=2, y=1}, {x=15, y=0}, {x=9, y=0}.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue