Skip to content

Commit

Permalink
Make tests stricter by adding "trap" states
Browse files Browse the repository at this point in the history
Signed-off-by: Enrico Ghiorzi <[email protected]>
  • Loading branch information
EnricoGhiorzi committed May 29, 2024
1 parent e02a33b commit b198681
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scan_fmt_xml/tests/test_enumdata/fsm.scxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,31 @@
</datamodel>

<state id="idle">
<transition target="loop" cond="state == RUNNING"/>
<transition target="loop" cond="state == SUCCESS"/>
<transition target="running" cond="state == FAILURE"/>
<transition target="loop"/>
</state>

<state id="running">
<onentry>
<assign location="state" expr="RUNNING"/>
</onentry>
<transition target="loop" cond="state == SUCCESS"/>
<transition target="loop" cond="state == FAILURE"/>
<transition target="finished" cond="state == RUNNING"/>
<transition target="loop"/>
<onexit>
<assign location="state" expr="SUCCESS"/>
</onexit>
</state>

<state id="finished"/>
<state id="finished">
<transition target="loop" cond="state == RUNNING"/>
<transition target="loop" cond="state == FAILURE"/>
</state>

<state id="loop">
<transition target="loop"/>
</state>
</scxml>
6 changes: 6 additions & 0 deletions scan_fmt_xml/tests/test_fsm/fsm.scxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@

<state id="idle">
<transition target="running"/>
<transition target="loop"/>
</state>

<state id="running">
<transition target="finished"/>
<transition target="loop"/>
</state>

<state id="finished"/>

<state id="loop">
<transition target="loop"/>
</state>
</scxml>
5 changes: 5 additions & 0 deletions scan_fmt_xml/tests/test_param/fsm_1.scxml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
<param name="result" expr="p + 1"/>
</send>
</transition>
<transition target="loop"/>
</state>

<state id="finished"/>

<state id="loop">
<transition target="loop"/>
</state>
</scxml>
10 changes: 10 additions & 0 deletions scan_fmt_xml/tests/test_send/fsm_2.scxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
initial="idle">

<state id="idle">
<!-- Autonomous transitions have priority -->
<transition event="message" target="loop"/>
<transition target="wait"/>
</state>

<state id="wait">
<transition event="message" target="finished"/>
</state>

<state id="finished"/>

<state id="loop">
<transition target="loop"/>
</state>
</scxml>

0 comments on commit b198681

Please sign in to comment.