software-testing/project_task_sheets/phase_05/project_phase05_tasks/Mutation_Testing_Sample_Model.xml
2022-07-14 13:47:30 +02:00

224 lines
6.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_2.dtd'>
<nta>
<declaration>typedef int[47,58] char;
broadcast chan initialized;
int c0_in = 0;
int c1_in = 0;
int c2_in = 0;
int c3_in = 0;</declaration>
<template>
<name>InputFromRange</name>
<location id="id0" x="-238" y="-204">
</location>
<location id="id1" x="-671" y="-204">
<urgent/>
</location>
<location id="id2" x="-434" y="-205">
<urgent/>
</location>
<init ref="id1"/>
<transition>
<source ref="id2"/>
<target ref="id0"/>
<label kind="synchronisation" x="-382" y="-229">initialized!</label>
</transition>
<transition>
<source ref="id1"/>
<target ref="id2"/>
<label kind="select" x="-603" y="-297">c0_val : char,
c1_val : char,
c2_val : char,
c3_val : char</label>
<label kind="assignment" x="-603" y="-187">c0_in = c0_val,
c1_in = c1_val,
c2_in = c2_val,
c3_in = c3_val</label>
</transition>
</template>
<template>
<name x="5" y="5">Number</name>
<declaration>int c0 = 0;
int c1 = 0;
int c2 = 0;
int c3 = 0;
int c = 0;</declaration>
<location id="id3" x="297" y="-34">
<name x="287" y="-68">End</name>
</location>
<location id="id4" x="51" y="-34">
<name x="8" y="-68">Branch</name>
</location>
<location id="id5" x="-161" y="-33">
<name x="-171" y="-67">Init</name>
<urgent/>
</location>
<init ref="id5"/>
<transition>
<source ref="id4"/>
<target ref="id3"/>
<label kind="guard" x="102" y="-17">!(c0 &gt;= 48 &amp;&amp; c0 &lt;= 57
&amp;&amp; c1 &gt;= 48 &amp;&amp; c1 &lt;= 57
&amp;&amp; c2 &gt;= 48 &amp;&amp; c2 &lt;= 57
&amp;&amp; c3 &gt;= 48 &amp;&amp; c3 &lt;= 57)</label>
<label kind="assignment" x="153" y="-68">c = -1</label>
<label kind="comments" x="195" y="-68">Invalid</label>
</transition>
<transition>
<source ref="id4"/>
<target ref="id3"/>
<label kind="guard" x="-8" y="-229">c0 &gt;= 48 &amp;&amp; c0 &lt;= 57
&amp;&amp; c1 &gt;= 48 &amp;&amp; c1 &lt;= 57
&amp;&amp; c2 &gt;= 48 &amp;&amp; c2 &lt;= 57
&amp;&amp; c3 &gt;= 48 &amp;&amp; c3 &lt;= 57</label>
<label kind="assignment" x="229" y="-229">c = (c0 - 48) * 1000
+ (c1 - 48) * 100
+ (c2 - 48) * 10
+ (c3 - 48)</label>
<label kind="comments" x="170" y="-221">Result</label>
<nail x="178" y="-170"/>
</transition>
<transition>
<source ref="id5"/>
<target ref="id4"/>
<label kind="synchronisation" x="-102" y="-59">initialized?</label>
<label kind="assignment" x="-102" y="-17">c0 = c0_in,
c1 = c1_in,
c2 = c2_in,
c3 = c3_in</label>
</transition>
</template>
<template>
<name x="5" y="5">NumberMutant</name>
<declaration>int c0 = 0;
int c1 = 0;
int c2 = 0;
int c3 = 0;
int c = 0;</declaration>
<location id="id6" x="297" y="-34">
<name x="287" y="-68">End</name>
</location>
<location id="id7" x="51" y="-34">
<name x="8" y="-68">Branch</name>
</location>
<location id="id8" x="-161" y="-33">
<name x="-171" y="-67">Init</name>
<urgent/>
</location>
<init ref="id8"/>
<transition>
<source ref="id7"/>
<target ref="id6"/>
<label kind="guard" x="102" y="-17">!(c0 &gt;= 48 &amp;&amp; c0 &lt;= 57
&amp;&amp; c1 &gt;= 48 &amp;&amp; c1 &lt;= 57
&amp;&amp; c2 &gt;= 48 &amp;&amp; c2 &lt;= 57
&amp;&amp; c3 &gt;= 48)</label>
<label kind="assignment" x="153" y="-68">c = -1</label>
<label kind="comments" x="195" y="-68">Invalid</label>
</transition>
<transition>
<source ref="id7"/>
<target ref="id6"/>
<label kind="guard" x="-8" y="-229">c0 &gt;= 48 &amp;&amp; c0 &lt;= 57
&amp;&amp; c1 &gt;= 48 &amp;&amp; c1 &lt;= 57
&amp;&amp; c2 &gt;= 48 &amp;&amp; c2 &lt;= 57
&amp;&amp; c3 &gt;= 48</label>
<label kind="assignment" x="229" y="-229">c = (c0 - 48) * 1000
+ (c1 - 48) * 100
+ (c2 - 48) * 10
+ (c3 - 48)</label>
<label kind="comments" x="170" y="-221">Result</label>
<nail x="178" y="-170"/>
</transition>
<transition>
<source ref="id8"/>
<target ref="id7"/>
<label kind="synchronisation" x="-102" y="-59">initialized?</label>
<label kind="assignment" x="-102" y="-17">c0 = c0_in,
c1 = c1_in,
c2 = c2_in,
c3 = c3_in</label>
</transition>
</template>
<template>
<name x="5" y="5">NumberBranch</name>
<declaration>int c0 = 0;
int c1 = 0;
int c2 = 0;
int c3 = 0;
int c = 0;</declaration>
<location id="id9" x="297" y="-34">
<name x="287" y="-68">End</name>
</location>
<location id="id10" x="51" y="-34">
<name x="8" y="-68">Branch</name>
</location>
<location id="id11" x="-161" y="-33">
<name x="-171" y="-67">Init</name>
<urgent/>
</location>
<init ref="id11"/>
<transition>
<source ref="id10"/>
<target ref="id9"/>
<label kind="guard" x="102" y="-17">!(c0 &gt;= 48 &amp;&amp; c0 &lt;= 57
&amp;&amp; c1 &gt;= 48 &amp;&amp; c1 &lt;= 57
&amp;&amp; c2 &gt;= 48 &amp;&amp; c2 &lt;= 57
&amp;&amp; c3 &gt;= 48 &amp;&amp; c3 &lt;= 57)
&amp;&amp; c == -2</label>
<label kind="assignment" x="153" y="-68">c = -1</label>
<label kind="comments" x="195" y="-68">Invalid</label>
</transition>
<transition>
<source ref="id10"/>
<target ref="id10"/>
<label kind="guard" x="-8" y="-229">c0 &gt;= 48 &amp;&amp; c0 &lt;= 57
&amp;&amp; c1 &gt;= 48 &amp;&amp; c1 &lt;= 57
&amp;&amp; c2 &gt;= 48 &amp;&amp; c2 &lt;= 57
&amp;&amp; c3 &gt;= 48 &amp;&amp; c3 &lt;= 57
&amp;&amp; c == -2</label>
<label kind="assignment" x="229" y="-229">c = (c0 - 48) * 1000
+ (c1 - 48) * 100
+ (c2 - 48) * 10
+ (c3 - 48)</label>
<label kind="comments" x="170" y="-221">Result</label>
<nail x="178" y="-170"/>
<nail x="221" y="-119"/>
</transition>
<transition>
<source ref="id11"/>
<target ref="id10"/>
<label kind="synchronisation" x="-102" y="-59">initialized?</label>
<label kind="assignment" x="-102" y="-17">c0 = c0_in,
c1 = c1_in,
c2 = c2_in,
c3 = c3_in,
c = -2</label>
</transition>
</template>
<system>NUM = Number();
// NUM = NumberMutant(); // to test the expression mutation
// NUM = NumberBranch(); // to test the branch mutation
IN_RANGE = InputFromRange();
system IN_RANGE, NUM;</system>
<queries>
<query>
<formula>A[] NUM.End imply (NUM.c &gt;= -1 &amp;&amp; NUM.c &lt; 10000)</formula>
<comment>Return value of the function is always a 4 digit number or -1.</comment>
</query>
<query>
<formula>A[] not deadlock || NUM.End</formula>
<comment>Model never deadlocks and always reaches the end location.</comment>
</query>
<query>
<formula>A[] (NUM.End imply (NUM.c1 == 48 &amp;&amp; NUM.c1 == 49 &amp;&amp; NUM.c2 == 50 &amp;&amp; NUM.c3 == 51 imply NUM.c == 1234))</formula>
<comment>Simple test case.</comment>
</query>
</queries>
</nta>