Browse Source

Fixed all tests.

Joeri Exelmans 5 years ago
parent
commit
a6753bd559

+ 1 - 1
.gitignore

@@ -10,7 +10,7 @@ RemoteSystemsTempFiles
 csharp_tests/test-results
 csharp_tests/bin
 src/build
-**/*target*
+# **/*target*
 test/build/
 **/*.lprof
 doc/_build

+ 2 - 2
src/sccd/compiler/schema/sccd.xsd

@@ -196,8 +196,8 @@
     <xsd:attribute name="combo_step_maximality">
       <xsd:simpleType>
         <xsd:restriction base="xsd:string">
-          <xsd:enumeration value="take_one"/>
-          <xsd:enumeration value="take_many"/>
+          <xsd:enumeration value="combo_take_one"/>
+          <xsd:enumeration value="combo_take_many"/>
         </xsd:restriction>
       </xsd:simpleType>
     </xsd:attribute>

+ 1 - 1
src/sccd/runtime/xml_loader.py

@@ -79,7 +79,7 @@ def load_model(src_file) -> Tuple[Model, Optional[Test]]:
     _class.statechart = statechart
 
     model.classes[class_name] = lambda: _class
-    if default:
+    if default or len(classes) == 1:
       model.default_class = class_name
 
   def find_ports(element_path, collection):

+ 4 - 4
test/test_files/semantics/original_semantics/history_deep.xml

@@ -10,7 +10,7 @@
     <class name="Class1" default="true">
         <scxml
             big_step_maximality="take_many"
-            combo_step_maximality="take_many"
+            combo_step_maximality="combo_take_many"
             internal_event_lifeline="queue">
             <parallel id="parallel">
                 <state id="orthogonal" initial="wrapper">
@@ -47,19 +47,19 @@
                         </transition>
                     </state>
                     <state id="step1">
-                        <transition cond="INSTATE('/parallel/orthogonal/wrapper/state_2/inner_4')" target="../step2">
+                        <transition cond='INSTATE(["/parallel/orthogonal/wrapper/state_2/inner_4"])' target="../step2">
                             <raise port="out" event="check1" />
                             <raise event="to_outer" />
                         </transition>
                     </state>
                     <state id="step2">
-                        <transition cond="INSTATE('/parallel/orthogonal/outer')" target="../step3">
+                        <transition cond='INSTATE(["/parallel/orthogonal/outer"])' target="../step3">
                             <raise port="out" event="check2" />
                             <raise event="to_history" />
                         </transition>
                     </state>
                     <state id="step3">
-                        <transition cond="INSTATE('/parallel/orthogonal/wrapper/state_2/inner_4')" target="../end">
+                        <transition cond='INSTATE(["/parallel/orthogonal/wrapper/state_2/inner_4"])' target="../end">
                             <raise port="out" event="check3" />
                         </transition>
                     </state>

+ 3 - 3
test/test_files/semantics/original_semantics/history_parallel_deep.xml

@@ -45,20 +45,20 @@
                         </transition>
                     </state>
                     <state id="step1">
-                        <transition cond="INSTATE('/parallel/orthogonal/wrapper/state_2/inner_4', '/parallel/orthogonal/wrapper/state_1/inner_2')" 
+                        <transition cond='INSTATE(["/parallel/orthogonal/wrapper/state_2/inner_4", "/parallel/orthogonal/wrapper/state_1/inner_2"])'
                                     target="../step2">
                             <raise port="out" event="check1" />
                             <raise event="to_outer" />
                         </transition>
                     </state>
                     <state id="step2">
-                        <transition cond="INSTATE('/parallel/orthogonal/outer')" target="../step3">
+                        <transition cond='INSTATE(["/parallel/orthogonal/outer"])' target="../step3">
                             <raise port="out" event="check2" />
                             <raise event="to_history" />
                         </transition>
                     </state>
                     <state id="step3">
-                        <transition cond="INSTATE('/parallel/orthogonal/wrapper/state_2/inner_4', '/parallel/orthogonal/wrapper/state_1/inner_2')" target="../end">
+                        <transition cond='INSTATE(["/parallel/orthogonal/wrapper/state_2/inner_4", "/parallel/orthogonal/wrapper/state_1/inner_2"])' target="../end">
                             <raise port="out" event="check3" />
                         </transition>
                     </state>

+ 3 - 3
test/test_files/semantics/original_semantics/instate.xml

@@ -23,15 +23,15 @@
                 </state>
                 <state id="orthogonal2" initial="tester">
                     <state id="tester">
-                        <transition cond="INSTATE('/parallel_1/orthogonal1/state1')" target=".">
+                        <transition cond='INSTATE(["/parallel_1/orthogonal1/state1"])' target=".">
                             <raise port="test_output" event="check1"/>
                             <raise event="to_inner"/>
                         </transition>
-                        <transition cond="INSTATE('/parallel_1/orthogonal1/inner/state2')" target=".">
+                        <transition cond='INSTATE(["/parallel_1/orthogonal1/inner/state2"])' target=".">
                             <raise port="test_output" event="check2"/>
                             <raise event="to_state3"/>
                         </transition>
-                        <transition cond="INSTATE('/parallel_1/orthogonal1/inner/state3')" target="../stop">
+                        <transition cond='INSTATE(["/parallel_1/orthogonal1/inner/state3"])' target="../stop">
                             <raise port="test_output" event="check3"/>
                         </transition>
                     </state>

+ 129 - 0
test/test_files/semantics/original_semantics/multiple_target+Class1.svg

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: state transitions Pages: 1 -->
+<svg width="330pt" height="400pt"
+ viewBox="0.00 0.00 330.00 400.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 396)">
+<title>state transitions</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-396 326,-396 326,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster__parallel</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M20,-8C20,-8 302,-8 302,-8 308,-8 314,-14 314,-20 314,-20 314,-242 314,-242 314,-248 308,-254 302,-254 302,-254 20,-254 20,-254 14,-254 8,-248 8,-242 8,-242 8,-20 8,-20 8,-14 14,-8 20,-8"/>
+<text text-anchor="start" x="141.6668" y="-235.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">parallel</text>
+</g>
+<g id="clust2" class="cluster">
+<title>cluster__parallel_orthogonal_1</title>
+<polygon fill="none" stroke="#000000" stroke-dasharray="5,2" points="30,-16 30,-216 164,-216 164,-16 30,-16"/>
+<text text-anchor="start" x="61.9852" y="-197.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">orthogonal_1</text>
+</g>
+<g id="clust3" class="cluster">
+<title>cluster__parallel_orthogonal_2</title>
+<polygon fill="none" stroke="#000000" stroke-dasharray="5,2" points="172,-16 172,-216 306,-216 306,-16 172,-16"/>
+<text text-anchor="start" x="203.9852" y="-197.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">orthogonal_2</text>
+</g>
+<!-- __initial -->
+<g id="node1" class="node">
+<title>__initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="140" cy="-386.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _next_to_parallel -->
+<g id="node2" class="node">
+<title>_next_to_parallel</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="193,-353 87,-353 87,-317 193,-317 193,-353"/>
+<text text-anchor="start" x="97.655" y="-331.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">next_to_parallel</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M99.3333,-318C99.3333,-318 180.6667,-318 180.6667,-318 186.3333,-318 192,-323.6667 192,-329.3333 192,-329.3333 192,-340.6667 192,-340.6667 192,-346.3333 186.3333,-352 180.6667,-352 180.6667,-352 99.3333,-352 99.3333,-352 93.6667,-352 88,-346.3333 88,-340.6667 88,-340.6667 88,-329.3333 88,-329.3333 88,-323.6667 93.6667,-318 99.3333,-318"/>
+</g>
+<!-- __initial&#45;&gt;_next_to_parallel -->
+<g id="edge1" class="edge">
+<title>__initial&#45;&gt;_next_to_parallel</title>
+<path fill="none" stroke="#000000" d="M140,-380.9886C140,-376.6293 140,-370.1793 140,-363.4801"/>
+<polygon fill="#000000" stroke="#000000" points="143.5001,-363.0122 140,-353.0122 136.5001,-363.0122 143.5001,-363.0122"/>
+<text text-anchor="middle" x="141.3895" y="-364" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- ]split0 -->
+<g id="node3" class="node">
+<title>]split0</title>
+<polygon fill="#000000" stroke="#000000" stroke-width="2" points="167,-289 113,-289 113,-282 167,-282 167,-289"/>
+<text text-anchor="middle" x="140" y="-281.9" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000"> </text>
+</g>
+<!-- _next_to_parallel&#45;&gt;]split0 -->
+<g id="edge4" class="edge">
+<title>_next_to_parallel&#45;&gt;]split0</title>
+<path fill="none" stroke="#000000" d="M140,-316.8491C140,-311.1375 140,-304.9201 140,-299.5394"/>
+<polygon fill="#000000" stroke="#000000" points="143.5001,-299.1348 140,-289.1348 136.5001,-299.1349 143.5001,-299.1348"/>
+<text text-anchor="middle" x="141.3895" y="-300" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _parallel_orthogonal_1_inner_2 -->
+<g id="node8" class="node">
+<title>_parallel_orthogonal_1_inner_2</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="100,-178 38,-178 38,-142 100,-142 100,-178"/>
+<text text-anchor="start" x="48.9942" y="-156.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">inner_2</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M50.3333,-143C50.3333,-143 87.6667,-143 87.6667,-143 93.3333,-143 99,-148.6667 99,-154.3333 99,-154.3333 99,-165.6667 99,-165.6667 99,-171.3333 93.3333,-177 87.6667,-177 87.6667,-177 50.3333,-177 50.3333,-177 44.6667,-177 39,-171.3333 39,-165.6667 39,-165.6667 39,-154.3333 39,-154.3333 39,-148.6667 44.6667,-143 50.3333,-143"/>
+</g>
+<!-- ]split0&#45;&gt;_parallel_orthogonal_1_inner_2 -->
+<g id="edge5" class="edge">
+<title>]split0&#45;&gt;_parallel_orthogonal_1_inner_2</title>
+<path fill="none" stroke="#000000" d="M135.964,-281.7366C130.1141,-276.1235 119.1939,-265.0322 112,-254 98.3105,-233.0064 86.7601,-206.9433 79.089,-187.5896"/>
+<polygon fill="#000000" stroke="#000000" points="82.3083,-186.2102 75.4403,-178.1429 75.7784,-188.7323 82.3083,-186.2102"/>
+<text text-anchor="middle" x="128.3895" y="-265" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _parallel_orthogonal_2_inner_4 -->
+<g id="node12" class="node">
+<title>_parallel_orthogonal_2_inner_4</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="242,-178 180,-178 180,-142 242,-142 242,-178"/>
+<text text-anchor="start" x="190.9942" y="-156.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">inner_4</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M192.3333,-143C192.3333,-143 229.6667,-143 229.6667,-143 235.3333,-143 241,-148.6667 241,-154.3333 241,-154.3333 241,-165.6667 241,-165.6667 241,-171.3333 235.3333,-177 229.6667,-177 229.6667,-177 192.3333,-177 192.3333,-177 186.6667,-177 181,-171.3333 181,-165.6667 181,-165.6667 181,-154.3333 181,-154.3333 181,-148.6667 186.6667,-143 192.3333,-143"/>
+</g>
+<!-- ]split0&#45;&gt;_parallel_orthogonal_2_inner_4 -->
+<g id="edge6" class="edge">
+<title>]split0&#45;&gt;_parallel_orthogonal_2_inner_4</title>
+<path fill="none" stroke="#000000" d="M144.205,-281.7747C150.2948,-276.209 161.6433,-265.1762 169,-254 182.725,-233.1491 193.9745,-207.073 201.3649,-187.678"/>
+<polygon fill="#000000" stroke="#000000" points="204.6813,-188.8009 204.8705,-178.2078 198.1166,-186.3708 204.6813,-188.8009"/>
+<text text-anchor="middle" x="163.3895" y="-265" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _parallel -->
+<!-- _parallel_orthogonal_1 -->
+<!-- _parallel_orthogonal_1_initial -->
+<g id="node6" class="node">
+<title>_parallel_orthogonal_1_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="128" cy="-160" rx="5.5" ry="5.5"/>
+</g>
+<!-- _parallel_orthogonal_1_inner_1 -->
+<g id="node7" class="node">
+<title>_parallel_orthogonal_1_inner_1</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="156,-60 94,-60 94,-24 156,-24 156,-60"/>
+<text text-anchor="start" x="104.9942" y="-38.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">inner_1</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M106.3333,-25C106.3333,-25 143.6667,-25 143.6667,-25 149.3333,-25 155,-30.6667 155,-36.3333 155,-36.3333 155,-47.6667 155,-47.6667 155,-53.3333 149.3333,-59 143.6667,-59 143.6667,-59 106.3333,-59 106.3333,-59 100.6667,-59 95,-53.3333 95,-47.6667 95,-47.6667 95,-36.3333 95,-36.3333 95,-30.6667 100.6667,-25 106.3333,-25"/>
+</g>
+<!-- _parallel_orthogonal_1_initial&#45;&gt;_parallel_orthogonal_1_inner_1 -->
+<g id="edge2" class="edge">
+<title>_parallel_orthogonal_1_initial&#45;&gt;_parallel_orthogonal_1_inner_1</title>
+<path fill="none" stroke="#000000" d="M127.4953,-154.4713C126.9028,-147.493 126,-135.1175 126,-124.5 126,-124.5 126,-124.5 126,-77.5 126,-75.107 125.977,-72.6235 125.938,-70.1322"/>
+<polygon fill="#000000" stroke="#000000" points="129.4354,-69.9735 125.7054,-60.057 122.4372,-70.1351 129.4354,-69.9735"/>
+<text text-anchor="middle" x="127.3895" y="-98" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _parallel_orthogonal_2 -->
+<!-- _parallel_orthogonal_2_initial -->
+<g id="node10" class="node">
+<title>_parallel_orthogonal_2_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="270" cy="-160" rx="5.5" ry="5.5"/>
+</g>
+<!-- _parallel_orthogonal_2_inner_3 -->
+<g id="node11" class="node">
+<title>_parallel_orthogonal_2_inner_3</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="298,-60 236,-60 236,-24 298,-24 298,-60"/>
+<text text-anchor="start" x="246.9942" y="-38.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">inner_3</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M248.3333,-25C248.3333,-25 285.6667,-25 285.6667,-25 291.3333,-25 297,-30.6667 297,-36.3333 297,-36.3333 297,-47.6667 297,-47.6667 297,-53.3333 291.3333,-59 285.6667,-59 285.6667,-59 248.3333,-59 248.3333,-59 242.6667,-59 237,-53.3333 237,-47.6667 237,-47.6667 237,-36.3333 237,-36.3333 237,-30.6667 242.6667,-25 248.3333,-25"/>
+</g>
+<!-- _parallel_orthogonal_2_initial&#45;&gt;_parallel_orthogonal_2_inner_3 -->
+<g id="edge3" class="edge">
+<title>_parallel_orthogonal_2_initial&#45;&gt;_parallel_orthogonal_2_inner_3</title>
+<path fill="none" stroke="#000000" d="M269.4953,-154.4713C268.9028,-147.493 268,-135.1175 268,-124.5 268,-124.5 268,-124.5 268,-77.5 268,-75.107 267.977,-72.6235 267.938,-70.1322"/>
+<polygon fill="#000000" stroke="#000000" points="271.4354,-69.9735 267.7054,-60.057 264.4372,-70.1351 271.4354,-69.9735"/>
+<text text-anchor="middle" x="269.3895" y="-98" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+</g>
+</svg>

+ 58 - 0
test/test_files/semantics/original_semantics/multiple_target.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" ?>
+<diagram
+	xmlns="msdl.uantwerpen.be/sccd"
+	author="Glenn De Jonghe"
+	name="TestMultipleTarget">
+    <description>
+        Testing the enter-exit sequence when having a transition that specificies a target state with multiple nodes.
+    </description>
+    <inport name="test_input" />
+    <outport name="test_output" />
+    <class name="Class1" default="true">
+        <scxml initial="next_to_parallel">
+            <parallel id="parallel">
+                <state id="orthogonal_1" initial="inner_1">
+                    <state id="inner_1">
+                        <onentry>
+                           <raise port="test_output" event="enter_1_1" />
+                        </onentry>
+                    </state>
+                    <state id="inner_2">
+                        <onentry>
+                           <raise port="test_output" event="enter_1_2" />
+                        </onentry>
+                    </state>
+                </state>
+                <state id="orthogonal_2" initial="inner_3">
+                    <state id="inner_3">
+                        <onentry>
+                           <raise port="test_output" event="enter_2_3" />
+                        </onentry>
+                    </state>
+                    <state id="inner_4">
+                        <onentry>
+                           <raise port="test_output" event="enter_2_4" />
+                        </onentry>
+                    </state>
+                </state>
+            </parallel>
+            <state id="next_to_parallel">
+                <onentry>
+                    <raise port="test_output" event="enter_0" />
+                </onentry>
+                <transition target="(/parallel/orthogonal_1/inner_2, /parallel/orthogonal_2/inner_4)"/>
+            </state>
+        </scxml>
+    </class>
+    <test>
+       <expected>
+          <slot>
+               <event name="enter_0" port="test_output"/>
+           </slot>
+           <slot>
+               <event name="enter_1_2" port="test_output"/>
+               <event name="enter_2_4" port="test_output"/>
+           </slot>
+        </expected>
+    </test>
+</diagram>