Some more questions

This commit is contained in:
Marco Realacci 2022-12-28 21:41:07 +01:00
parent 9b43943876
commit 40dd6bd99b
12 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1 @@
(a=100, b=false, c=true), (a=90, b=true, c=false)

View file

@ -0,0 +1,20 @@
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 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 in 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, bool b, bool c)
{ if ( (a == 100) && (b || c) )
{ return (1); }
else { return (2);}
}
Quale dei seguenti test set soddisfa il criterio della Condition/Decision coverage?

View file

@ -0,0 +1 @@
(a=100, b=false, c=false), (a=90, b=true, c=true)

View file

@ -0,0 +1 @@
(a=100, b=false, c=true), (a=90, b=false, c=true)

View file

@ -0,0 +1 @@
50%

View file

@ -0,0 +1,57 @@
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] = 5; x2[0] = -2; x1[1] = 6; 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?

View file

@ -0,0 +1 @@
80%

View file

@ -0,0 +1 @@
100%

View file

@ -0,0 +1 @@
Customers should be closely involved throughout the development process.

View file

@ -0,0 +1 @@
Which of the following is an agile principle?

View file

@ -0,0 +1 @@
Customers should just provide requirements and verify them when the project is completed.

View file

@ -0,0 +1 @@
Customers should not interfere with the software development.