blob: 86da620bc8fd6eb58c52d1d1c6e3389adfc4cf89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?xml version="1.0" standalone="no"?>
<!-- test that an internal transition does not exit its source state -->
<scxml xmlns="http://www.w3.org/2005/07/scxml" initial="s1" version="1.0" datamodel="lua">
<datamodel>
<data expr="0" id="testvar1"/>
<!-- how often we have exited s1 -->
<data expr="0" id="testvar2"/>
<!-- how often we have exited s11 -->
<data expr="0" id="testvar3"/>
<!-- how often the transition for foo has been taken -->
</datamodel>
<state id="s1">
<onentry>
<raise event="foo"/>
<raise event="bar"/>
</onentry>
<onexit>
<assign location="testvar1" expr="testvar1+1"/>
</onexit>
<transition event="foo" type="internal" target="s11">
<assign location="testvar3" expr="testvar3+1"/>
</transition>
<!-- make sure the transition on foo was actually taken -->
<transition event="bar" target="s2" cond="testvar3 == 1"/>
<transition event="bar" target="fail"/>
<state id="s11">
<onexit>
<assign location="testvar2" expr="testvar2+1"/>
</onexit>
</state>
</state>
<state id="s2">
<!-- make sure that s1 was exited once -->
<transition target="s3" cond="testvar1 == 1"/>
<transition target="fail"/>
</state>
<state id="s3">
<!-- make sure that s11 was exited twice -->
<transition cond="testvar2 == 2" target="pass"/>
<transition target="fail"/>
</state>
<final id="pass"/>
<final id="fail"/>
</scxml>
|