summaryrefslogtreecommitdiffstats
path: root/test/w3c/prolog/test525.scxml
blob: a2a63e8fce1ca83c90387ef4d38942d6facdd522 (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
<?xml version="1.0" encoding="UTF-8"?>
<!-- test that <foreach> does a shallow copy, so that modifying the array does not change
the iteration behavior. -->
<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="prolog" version="1.0">
  <datamodel>
    <data id="var1">
      [1,2,3]
      </data>
    <data id="var2" expr="0"/>
    <!-- counts the number of iterations -->
  </datamodel>
  <state id="s0">
    <onentry>
      <foreach item="var3" array="var1(X), member(M, X)">
        <assign location="var1" expr="[].concat(Var1, [4])"/>
        <assign location="var2(Y)" expr="var2(X), Y is X + 1, retractall(var1(_))"/>
      </foreach>
    </onentry>
    <transition cond="X = 3, var2(X)" target="pass"/>
    <transition target="fail"/>
  </state>
  <final id="pass">
    <onentry>
      <log label="Outcome" expr="'pass'"/>
    </onentry>
  </final>
  <final id="fail">
    <onentry>
      <log label="Outcome" expr="'fail'"/>
    </onentry>
  </final>
</scxml>