ingsw: Add 09-22

This commit is contained in:
Marco Realacci 2023-01-02 03:39:02 +01:00
parent fb2aa7120e
commit 1b1633659c
64 changed files with 1312 additions and 0 deletions

View file

@ -0,0 +1,69 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,2 @@
img=https://i.imgur.com/okpLYQL.png
Quale dei seguenti modelli Modelica rappresenta lo state diagram in figura ?

View file

@ -0,0 +1,67 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 0;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,69 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
60%

View file

@ -0,0 +1,19 @@
img=https://i.imgur.com/im1GU0x.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 act1 act2 act2
Test case 2: act2 act2 act1 act2 act1 act2 act1 act2 act1 act2 act2 act1 act1 act2 act1 act2 act2 act2
Test case 3: act2 act2 act0
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?

View file

@ -0,0 +1 @@
100%

View file

@ -0,0 +1 @@
80%

View file

@ -0,0 +1 @@
90%

View file

@ -0,0 +1,17 @@
img=https://i.imgur.com/rWKWcCt.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 act0 act1 act1 act0 act0 act2 act0 act2 act2 act2 act1 act2 act2 act0 act0 act2 act1 act0 act0 act2 act2 act2 act0 act2 act2 act0 act2 act0 act1 act2 act1 act1 act1 act1 act0 act1 act0 act1 act2 act1 act2 act0
Test case 2: act0
Test case 3: act2 act0 act2 act2 act0 act2 act0 act2 act2 act2 act0 act0 act1 act2 act0 act2 act2 act0 act2 act2 act0 act2 act0 act2 act2 act2 act0 act1 act1 act1 act0 act0 act1 act1 act2 act0 act0 act2 act1 act0 act2 act2 act0 act2 act2 act0 act0 act2 act0 act1 act0
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?

View file

@ -0,0 +1 @@
100%

View file

@ -0,0 +1 @@
50%

View file

@ -0,0 +1 @@
50%

View file

@ -0,0 +1,15 @@
img=https://i.imgur.com/em6ovKG.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
Test case 2: act2 act1 act2 act0 act0 act0 act1 act0 act0 act1 act0
Test case 3: act2 act0
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?

View file

@ -0,0 +1 @@
100%

View file

@ -0,0 +1 @@
35%

View file

@ -0,0 +1,71 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,2 @@
img=https://i.imgur.com/512MuK3.png
Quale dei seguenti modelli Modelica rappresenta lo state diagram in figura ?

View file

@ -0,0 +1,71 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 0;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,69 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 2;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
60%

View file

@ -0,0 +1,16 @@
img=https://i.imgur.com/02dquYj.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
Test case 2: act1 act0 act2 act2 act2 act0 act2 act1 act2 act0 act1 act0
Test case 3: act2 act0
Quale delle seguenti è la migliore stima della transition coverage per i test cases di cui sopra?

View file

@ -0,0 +1 @@
75%

View file

@ -0,0 +1 @@
90%

View file

@ -0,0 +1 @@
img=https://i.imgur.com/Zzrmwyx.png

View file

@ -0,0 +1,75 @@
Si consideri il seguente modello Modelica. Quale dei seguenti state diagram lo rappresenta correttamente ?
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
img=https://i.imgur.com/3ANMdkr.png

View file

@ -0,0 +1 @@
img=https://i.imgur.com/2RoLmLS.png

View file

@ -0,0 +1,69 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 2;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,2 @@
img=https://i.imgur.com/WSvoelw.png
Quale dei seguenti modelli Modelica rappresenta lo state diagram in figura ?

View file

@ -0,0 +1,74 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 3;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,69 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 3;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
img=https://i.imgur.com/WRn8QOi.png

View file

@ -0,0 +1,75 @@
Si consideri il seguente modello Modelica. Quale dei seguenti state diagram lo rappresenta correttamente ?
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 0;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
img=https://i.imgur.com/oUj28ho.png

View file

@ -0,0 +1 @@
img=https://i.imgur.com/eVnEYDY.png

View file

@ -0,0 +1 @@
img=https://i.imgur.com/VgLa2I6.png

View file

@ -0,0 +1,77 @@
Si consideri il seguente modello Modelica. Quale dei seguenti state diagram lo rappresenta correttamente ?
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
img=https://i.imgur.com/5MjNRI5.png

View file

@ -0,0 +1 @@
img=https://i.imgur.com/ugOv25D.png

View file

@ -0,0 +1 @@
75%

View file

@ -0,0 +1,16 @@
img=https://i.imgur.com/PkKCYTb.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: act2 act0 act1 act1 act0 act2 act1 act2 act2 act1 act2 act0 act1 act2 act0 act2 act2 act0 act1 act1 act2 act2 act0 act0 act2 act2 act2 act0 act2 act0 act1 act1 act0 act2 act1 act2 act1 act0 act0 act0 act0 act2 act2 act1 act1 act1 act1 act0
Test case 2: act1 act2 act0 act2 act2 act1 act1 act0 act1 act2 act2 act0
Test case 3: act1 act1 act2 act0 act1 act0
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra

View file

@ -0,0 +1 @@
100%

View file

@ -0,0 +1 @@
60%

View file

@ -0,0 +1,67 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 1;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,2 @@
img=https://i.imgur.com/XthureL.png
Quale dei seguenti modelli Modelica rappresenta lo state diagram in figura ?

View file

@ -0,0 +1,69 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 3;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1,71 @@
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 1) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 1) then x := 3;
elseif (pre(x) == 1) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 3;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 1;
elseif (pre(x) == 4) and (pre(u) == 1) then x := 0;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 0;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
img=https://i.imgur.com/2GmgSsg.png

View file

@ -0,0 +1,73 @@
Si consideri il seguente modello Modelica. Quale dei seguenti state diagram lo rappresenta correttamente ?
block FSA // Finite State Automaton
/* connector declarations outside this block:
connector InputInteger = input Integer;
connector OutputInteger = output Integer;
*/
InputInteger u; // external input
OutputInteger x; // state
parameter Real T = 1;
algorithm
when initial() then
x := 0;
elsewhen sample(0,T) then
if (pre(x) == 0) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 0) and (pre(u) == 1) then x := 1;
elseif (pre(x) == 0) and (pre(u) == 2) then x := 4;
elseif (pre(x) == 1) and (pre(u) == 0) then x := 3;
elseif (pre(x) == 2) and (pre(u) == 0) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 2) and (pre(u) == 2) then x := 1;
elseif (pre(x) == 3) and (pre(u) == 0) then x := 0;
elseif (pre(x) == 3) and (pre(u) == 1) then x := 4;
elseif (pre(x) == 3) and (pre(u) == 2) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 0) then x := 2;
elseif (pre(x) == 4) and (pre(u) == 2) then x := 0;
else x := pre(x); // default
end if;
end when;
end FSA;

View file

@ -0,0 +1 @@
img=https://i.imgur.com/vB4iDg8.png

View file

@ -0,0 +1 @@
img=https://i.imgur.com/5Mtuh64.png

View file

@ -0,0 +1 @@
State coverage: 85%

View file

@ -0,0 +1,15 @@
img=https://i.imgur.com/YoZA1G0.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: act1 act2 act2 act1 act2 act1 act1 act0 act1 act2 act0 act1 act2 act1 act2 act1 act0 act0 act2 act2 act0 act1 act1 act2 act2 act2 act0 act1 act2 act2 act1
Test case 2: act1 act2 act0 act0 act2 act2 act2 act2 act2 act1 act2 act0 act0 act2 act1 act2 act2 act2 act0 act0 act2 act1 act2 act2 act2 act0 act0 act1
Test case 3: act1 act1
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra

View file

@ -0,0 +1 @@
State coverage: 60%

View file

@ -0,0 +1 @@
State coverage: 100%

View file

@ -0,0 +1 @@
State coverage: 60%

View file

@ -0,0 +1,18 @@
img=https://i.imgur.com/PqUZdeV.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
Test case 2: act0 act0 act1 act1 act0 act1 act2 act0 act0 act1 act1 act2 act1 act2 act0 act0 act0 act2
Test case 3: act2 act0 act1 act2 act2
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra

View file

@ -0,0 +1 @@
State coverage: 75%

View file

@ -0,0 +1 @@
State coverage: 90%

View file

@ -0,0 +1 @@
State coverage: 75%

View file

@ -0,0 +1,17 @@
img=https://i.imgur.com/dIi2Wn7.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 act1 act2 act0 act2 act0 act0 act0 act0 act0 act2
Test case 2: act1 act2 act1 act2 act0 act2 act1 act2 act2
Test case 3: act2
Quale delle seguenti è la migliore stima della state coverage per i test cases di cui sopra

View file

@ -0,0 +1 @@
State coverage: 90%

View file

@ -0,0 +1 @@
State coverage: 60%