summaryrefslogtreecommitdiffstats
path: root/test/uscxml/promela
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-04-22 14:02:03 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-04-22 14:02:03 (GMT)
commit1fb6bcf30f954e426f2d3002d14887574fb941dd (patch)
tree08cff7f2b879c50efe79e3c04d255075522af862 /test/uscxml/promela
parent71c334bf4e35559496feac3f3cf00b72ceb88812 (diff)
downloaduscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.zip
uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.gz
uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.bz2
Major refactoring
- Moved tests - Changes to promela datamodel - Implemented Trie
Diffstat (limited to 'test/uscxml/promela')
-rw-r--r--test/uscxml/promela/test-invokers.scxml21
-rw-r--r--test/uscxml/promela/test-non-progress.scxml17
-rw-r--r--test/uscxml/promela/test-progress-label.scxml20
-rw-r--r--test/uscxml/promela/test-simple.scxml15
-rw-r--r--test/uscxml/promela/test-syntax.scxml122
5 files changed, 195 insertions, 0 deletions
diff --git a/test/uscxml/promela/test-invokers.scxml b/test/uscxml/promela/test-invokers.scxml
new file mode 100644
index 0000000..df94756
--- /dev/null
+++ b/test/uscxml/promela/test-invokers.scxml
@@ -0,0 +1,21 @@
+<scxml datamodel="promela">
+ <state id="s0">
+ <invoke type="scxml">
+ <!--
+ promela-event-source:
+ to.s1
+ -->
+ <content>
+ <scxml>
+ <state id="s0">
+ <onentry>
+ <send target="#_parent" event="to.s1" />
+ </onentry>
+ </state>
+ </scxml>
+ </content>
+ </invoke>
+ <transition event="to.s1" target="s1" />
+ </state>
+ <state id="s1" final="true" />
+</scxml> \ No newline at end of file
diff --git a/test/uscxml/promela/test-non-progress.scxml b/test/uscxml/promela/test-non-progress.scxml
new file mode 100644
index 0000000..2301bd6
--- /dev/null
+++ b/test/uscxml/promela/test-non-progress.scxml
@@ -0,0 +1,17 @@
+<!--
+ Check for no-progress cycles
+
+ $ uscxml-transform -s -i this_file.scxml > test.pml
+ $ spin -a test.pml
+ $ gcc -DNP pan.c
+ $ ./a.out -l
+-->
+<scxml datamodel="promela">
+ <state id="s0">
+ <onentry>
+ <raise event="foo" />
+ </onentry>
+ <transition event="foo" target="s0" />
+ </state>
+ <state id="s1" final="true" />
+</scxml> \ No newline at end of file
diff --git a/test/uscxml/promela/test-progress-label.scxml b/test/uscxml/promela/test-progress-label.scxml
new file mode 100644
index 0000000..8e27345
--- /dev/null
+++ b/test/uscxml/promela/test-progress-label.scxml
@@ -0,0 +1,20 @@
+<!--
+
+ Check for no-progress cycles
+
+ $ uscxml-transform -s -i this_file.scxml > test.pml
+ $ spin -a test.pml
+ $ gcc -DNP pan.c
+ $ ./a.out -l
+
+-->
+<scxml datamodel="promela">
+ <state id="s0">
+ <onentry>
+ <!-- promela-progress -->
+ <raise event="foo" />
+ </onentry>
+ <transition event="foo" target="s0" />
+ </state>
+ <state id="s1" final="true" />
+</scxml> \ No newline at end of file
diff --git a/test/uscxml/promela/test-simple.scxml b/test/uscxml/promela/test-simple.scxml
new file mode 100644
index 0000000..61c8022
--- /dev/null
+++ b/test/uscxml/promela/test-simple.scxml
@@ -0,0 +1,15 @@
+<!--
+ Simple example
+
+ $ uscxml-transform -s -i this_file.scxml > test.pml
+ $ spin -p -l -h test.pml
+-->
+<scxml datamodel="promela">
+ <state id="s0">
+ <onentry>
+ <raise event="foo" />
+ </onentry>
+ <transition event="foo" target="s1" />
+ </state>
+ <state id="s1" final="true" />
+</scxml> \ No newline at end of file
diff --git a/test/uscxml/promela/test-syntax.scxml b/test/uscxml/promela/test-syntax.scxml
new file mode 100644
index 0000000..619e138
--- /dev/null
+++ b/test/uscxml/promela/test-syntax.scxml
@@ -0,0 +1,122 @@
+<scxml datamodel="promela" binding="early" >
+ <!--
+ promela-event-source:
+ foo.bar
+ foo.baz foo.foo
+ error.communication
+ error.platform
+ err.foo
+ -->
+ <datamodel>
+ <data>
+ bool b1;
+ </data>
+ <data>
+ int fooSum = 0;
+ int fooIndex = 0;
+ int fooItem;
+ int foos[10];
+ </data>
+ <data>
+ bool b2, b3, b4;
+ </data>
+ <data>
+ bool b5, b6 = 3 + 4, b7, b8, b9;
+ </data>
+ <data>
+ bool c1; bool c2; bool c3; bool c4;
+ bool c5; bool c6; bool c7, c8 = 4 + 6, c9;
+ </data>
+ <data>
+ byte state = 1;
+ mtype = {
+ FATAL, NON_FATAL, COMPLETE, INCOMPLETE,
+ red, white, blue
+ }
+ </data>
+ <data>
+ bool busy[3];
+ bool lazy[4];
+ </data>
+ <data>
+ bool v3, v2 = 1;
+ </data>
+
+ </datamodel>
+ <state id="init">
+ <invoke type="scxml">
+ <!--
+ promela-event-source:
+ innerFoo
+ -->
+
+ <final id="stop">
+ <onentry>
+ <send target="#_parent" event="innerFoo" />
+ </onentry>
+ </final>
+ </invoke>
+ <onentry>
+ <!--
+ promela-inline:
+ progress: skip;
+ -->
+ <raise event="foo.bar" />
+ <script>
+ busy[4 - 3] = 1;
+ </script>
+ <log label="foos" expr="foos" />
+ <foreach item="fooItem" array="foos" index="fooIndex">
+ <script>
+ foos[fooIndex] = fooIndex;
+ </script>
+ </foreach>
+ <log label="foos" expr="foos" />
+ <foreach item="fooItem" array="foos" index="fooIndex">
+ <log label="fooItem" expr="fooItem" />
+ <script>
+ fooSum = fooSum + fooItem;
+ </script>
+ </foreach>
+ <log label="fooSum" expr="fooSum" />
+ <if cond="b1==0">
+ <script>
+ b2=1; b3=1;
+ </script>
+ <elseif cond="b1==1" />
+ <script>
+ b2=1; b3=1;
+ </script>
+ <else />
+ <script>
+ b2=1; b3=1;
+ </script>
+ </if>
+ <script>
+ v2=1; v3=1;
+ </script>
+ </onentry>
+ <transition target="pass" cond="v2==v3 &amp;&amp; busy[1] == 1" event="foo.bar">
+ <!--
+ promela-inline:
+ progress: skip;
+ -->
+ </transition>
+ <transition target="fail" event="*">
+ <!--
+ promela-inline:
+ progress: skip;
+ -->
+ </transition>
+ </state>
+ <final id="pass">
+ <onentry>
+ <log label="Outcome" expr="'pass'"/>
+ </onentry>
+ </final>
+ <final id="fail">
+ <onentry>
+ <log label="Outcome" expr="'fail'"/>
+ </onentry>
+ </final>
+</scxml> \ No newline at end of file