diff options
Diffstat (limited to 'test')
28 files changed, 520 insertions, 19 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a78c079..53ec38f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -109,9 +109,11 @@ foreach( W3C_TEST ${W3C_TESTS} ) if (NOT TEST_NAME MATCHES ".*sub.*") if (RUN_W3C_ECMA_TESTS AND TEST_NAME MATCHES "^ecma\\/.*") add_test(${TEST_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-w3c ${W3C_TEST}) + set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST FAILED") endif() if (RUN_W3C_XPATH_TESTS AND TEST_NAME MATCHES "^xpath\\/.*") add_test(${TEST_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-w3c ${W3C_TEST}) + set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST FAILED") endif() endif() endforeach() diff --git a/test/samples/uscxml/test-markup-passing.scxml b/test/samples/uscxml/test-markup-passing.scxml new file mode 100644 index 0000000..32866b1 --- /dev/null +++ b/test/samples/uscxml/test-markup-passing.scxml @@ -0,0 +1,54 @@ +<scxml binding="late" datamodel="ecmascript" + xmlns="http://www.w3.org/2005/07/scxml" + xmlns:foo="http://uscxml.tk.informatik.tu-darmstadt.de/foo.xsd"> + <!-- + embedded markup contains a single child + --> + <state id="markup-embedded-single"> + <datamodel> + <data id="markup"> + <root> + <child>1</child> + <foo:child>2</foo:child> + </root> + </data> + </datamodel> + <onentry> + <log label="markup-embedded-single" expr="markup.nodeName" /> + </onentry> + <transition cond="markup.nodeName === 'root'" target="markup-embedded-many" /> + </state> + + <!-- + embedded markup contains multiple childs + --> + <state id="markup-embedded-many"> + <datamodel> + <data id="markup"> + <root> + <child>1</child> + <foo:child>2</foo:child> + </root> + <root> + <child>1</child> + <foo:child>2</foo:child> + </root> + </data> + </datamodel> + <onentry> + <log label="markup-embedded-many" expr="markup.nodeName" /> + </onentry> + <transition cond="markup.nodeName === 'data'" target="markup-file" /> + </state> + + <state id="markup-file"> + <datamodel> + <data id="markup" src="test-markup.xml" /> + </datamodel> + <onentry> + <log label="markup-file" expr="markup.nodeName" /> + </onentry> + <transition cond="markup.nodeName === 'root'" target="exit" /> + </state> + <final id="exit" /> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-markup.xml b/test/samples/uscxml/test-markup.xml new file mode 100644 index 0000000..81da3d2 --- /dev/null +++ b/test/samples/uscxml/test-markup.xml @@ -0,0 +1,6 @@ +<root + xmlns="http://www.w3.org/2005/07/scxml" + xmlns:foo="http://uscxml.tk.informatik.tu-darmstadt.de/scenegraph.xsd"> + <child>1</child> + <foo:child>2</foo:child> +</root>
\ No newline at end of file diff --git a/test/samples/uscxml/test-scenegraph.scxml b/test/samples/uscxml/test-scenegraph.scxml index f0d1173..0efcd6d 100644 --- a/test/samples/uscxml/test-scenegraph.scxml +++ b/test/samples/uscxml/test-scenegraph.scxml @@ -23,17 +23,17 @@ </scenegraph:viewport> <scenegraph:viewport x="0" y="50%" width="50%" height="50%" id="scene3"> <scenegraph:rotation id="treeRotation" pitch="100deg" roll="3.15149rad" yaw="10deg"> - <scenegraph:node src="http://people.sc.fsu.edu/~jburkardt/data/obj/airboat.obj" /> + <scenegraph:node src="http://cs.iupui.edu/~aharris/webDesign/vrml/tree.wrl" /> </scenegraph:rotation> </scenegraph:viewport> <scenegraph:viewport x="50%" y="50%" width="50%" height="50%" id="scene4"> <scenegraph:translation x="0" y="0" z="0"> - <scenegraph:node src="http://people.sc.fsu.edu/~jburkardt/data/obj/airboat.obj" /> + <scenegraph:node src="scenegraph/HARD_MP_VAL_000.wrl" /> </scenegraph:translation> </scenegraph:viewport> <scenegraph:viewport x="50%" y="0" width="50%" height="50%" id="scene2"> <scenegraph:translation x="0" y="0" z="0"> - <scenegraph:node src="http://people.sc.fsu.edu/~jburkardt/data/obj/airboat.obj" /> + <scenegraph:node src="http://cs.iupui.edu/~aharris/mm/vrml4/house.wrl" /> </scenegraph:translation> </scenegraph:viewport> </scenegraph:display> diff --git a/test/samples/w3c/ecma/test159.scxml b/test/samples/w3c/ecma/test159.scxml index d144855..d7b7821 100644 --- a/test/samples/w3c/ecma/test159.scxml +++ b/test/samples/w3c/ecma/test159.scxml @@ -6,8 +6,8 @@ The send tag will raise an error so var1 should not be incremented. If it is fa <state id="s0"> <onentry> - <send event="thisWillFail" conf:illegaltarget=""/> - <conf:incrementId id="1"/> + <send event="thisWillFail" target="baz"/> + <assign location="Var1" expr="Var1 + 1"/> </onentry> <transition cond="Var1==1" target="fail"/> <transition target="pass"/> diff --git a/test/samples/w3c/ecma/test191.scxml b/test/samples/w3c/ecma/test191.scxml index a44856b..6e82274 100644 --- a/test/samples/w3c/ecma/test191.scxml +++ b/test/samples/w3c/ecma/test191.scxml @@ -22,7 +22,7 @@ pass, otherwise we fail. The timer insures that some event is generated and tha </content> </invoke> <transition event="childToParent" target="pass"/> - <transition event="*" target="pass"/> + <transition event="*" target="fail"/> </state> <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> diff --git a/test/samples/w3c/ecma/test354.scxml b/test/samples/w3c/ecma/test354.scxml new file mode 100644 index 0000000..3a3c33b --- /dev/null +++ b/test/samples/w3c/ecma/test354.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that event.data can be populated using both namelist, param and <content> +and that correct values are used --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> +<datamodel> + <data id="Var1" expr="1"/> + <data id="Var2"/> + <data id="Var3"/> + </datamodel> + +<state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" namelist="Var1"> + <param name="param1" expr="2"/> + </send> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.data.Var1"/> + <assign location="Var3" expr="_event.data.param1"/> + </transition> + <transition event="*" target="fail"> + </transition> + +</state> + +<state id="s1"> + + <transition cond="Var2==1" target="s2"/> + <transition target="fail"/> + </state> + +<state id="s2"> + <transition cond="Var3==2" target="s3"/> + <transition target="fail"/> + </state> + +<state id="s3"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event2"> + <content>foo</content> + </send> + </onentry> + <transition event="event2" cond="_event.data === 'foo'" target="pass"/> + <transition event="*" 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>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test415.scxml b/test/samples/w3c/ecma/test415.scxml new file mode 100644 index 0000000..159218b --- /dev/null +++ b/test/samples/w3c/ecma/test415.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- Test that the state machine halts when it enters a top-level final state. Since + the initial state is a final state, this machine should halt immediately without + processing "event1" which is raised in the final state's on-entry handler. This + is a manual test since there is no platform-independent way to test that event1 + is not processed --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="ecmascript"> + <final id="final"> + <onentry> + <raise event="event1"/> + </onentry> + </final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test483.scxml b/test/samples/w3c/ecma/test483.scxml new file mode 100644 index 0000000..0a1b236 --- /dev/null +++ b/test/samples/w3c/ecma/test483.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that foreach works correctly, iterating over node set in document order. + This tests assertions 483-485 --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1"> + <nodes xmlns=""> + <node/> + <node/> + <node/> + </nodes> + </data> + </datamodel> + +<state id="s0"> + <onentry> + <foreach array="$var1/nodes/node" item="item" index="pos"> + <assign location="$item" type="addattribute" attr="position" expr="$pos"/> + </foreach> + </onentry> + + <transition cond="$var1/nodes/node[1]/@position = 1 and $var1/nodes/node[2]/@position = 2 and $var1/nodes/node[3]/@position = 3" 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>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test513.scxml b/test/samples/w3c/ecma/test513.scxml new file mode 100644 index 0000000..c26d498 --- /dev/null +++ b/test/samples/w3c/ecma/test513.scxml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that we get an HTTP success code back on successful delivery. To run this test, implementations +must support an extension to send: if the parameter httpResponse is present with value 'true', then when +the processor gets an http response code back, it must raise an event 'http.n1.nrest' where 'ni' is +the first digit of the response code and 'nrest' are the remaining digits--><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + +<state id="s0" initial="s01"> + <datamodel> + <data id="Var1"/> + </datamodel> + + <onentry> + <send event="timeout" delay="30s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <!-- child script. Once we're running send childRunning to parent and include basicHTTPAccess URI --> + <scxml initial="child0" datamodel="ecmascript" version="1.0"> + <state id="child0"> + <onentry> + <send target="#_parent" event="childRunning"> + <param name="uri" expr="_ioprocessors['basichttp']['location']"/> + </send> + </onentry> + </state> + </scxml> + </content> + </invoke> + + <transition event="*" target="fail"/> + + <state id="s01"> + <!-- when we get the event from the child, extract the access uri and use + the basicHTTP event i/o processor to send it an event --> + <transition event="childRunning" target="s02"> + <assign location="Var1" expr="_event.data.uri"/> + <send event="test" targetexpr="Var1" httpResponse="true" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </transition> + </state> + + <state id="s02"> + <!-- the child should send this back automatically. It does not need to take + any transition on the event --> + <transition event="HTTP.2" target="pass"/> + </state> + </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 diff --git a/test/samples/w3c/ecma/test528.scxml b/test/samples/w3c/ecma/test528.scxml index edeb367..f0e8911 100644 --- a/test/samples/w3c/ecma/test528.scxml +++ b/test/samples/w3c/ecma/test528.scxml @@ -6,8 +6,7 @@ <transition event="error.execution" target="s1"/> <transition event="done.state.s0" target="fail"/> - <transition event="done.state.s0" target="fail"> - </transition> + <transition event="done.state.s0" target="fail"/> <state id="s01"> <transition target="s02"/> diff --git a/test/samples/w3c/txml/test159.txml b/test/samples/w3c/txml/test159.txml index abf1925..b7245c0 100644 --- a/test/samples/w3c/txml/test159.txml +++ b/test/samples/w3c/txml/test159.txml @@ -11,7 +11,7 @@ The send tag will raise an error so var1 should not be incremented. If it is fa <state id="s0"> <onentry> <send event="thisWillFail" conf:illegaltarget=""/> - <conf:incrementId id="1"/> + <conf:incrementID id="1"/> </onentry> <transition conf:idVal="1=1" conf:targetfail=""/> <transition conf:targetpass=""/> diff --git a/test/samples/w3c/txml/test191.txml b/test/samples/w3c/txml/test191.txml index 60b44a9..6f42159 100644 --- a/test/samples/w3c/txml/test191.txml +++ b/test/samples/w3c/txml/test191.txml @@ -25,7 +25,7 @@ pass, otherwise we fail. The timer insures that some event is generated and tha </content> </invoke> <transition event="childToParent" conf:targetpass=""/> - <transition event="*" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> </state> <conf:pass/> diff --git a/test/samples/w3c/txml/test354.txml b/test/samples/w3c/txml/test354.txml new file mode 100644 index 0000000..d9e643a --- /dev/null +++ b/test/samples/w3c/txml/test354.txml @@ -0,0 +1,56 @@ +<?xml version="1.0"?> + +<!-- test that event.data can be populated using both namelist, param and <content> +and that correct values are used --> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1" expr="1"/> + <data conf:id="2"/> + <data conf:id="3"/> + </datamodel> + +<state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" namelist="Var1"> + <param name="param1" conf:expr="2"/> + </send> + </onentry> + <transition event="event1" target="s1"> + <assign conf:location="2" conf:eventDataNamelistValue="Var1"/> + <assign conf:location="3" conf:eventDataParamValue="param1"/> + </transition> + <transition event="*" conf:targetfail=""> + </transition> + +</state> + +<state id="s1"> + + <transition conf:idVal="2=1" target="s2"/> + <transition conf:targetfail=""/> + </state> + +<state id="s2"> + <transition conf:idVal="3=2" target="s3"/> + <transition conf:targetfail=""/> + </state> + +<state id="s3"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event2"> + <content>foo</content> + </send> + </onentry> + <transition event="event2" conf:eventdataVal="foo" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + +</state> + + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test415.txml b/test/samples/w3c/txml/test415.txml new file mode 100644 index 0000000..5bb3343 --- /dev/null +++ b/test/samples/w3c/txml/test415.txml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<!-- Test that the state machine halts when it enters a top-level final state. Since + the initial state is a final state, this machine should halt immediately without + processing "event1" which is raised in the final state's on-entry handler. This + is a manual test since there is no platform-independent way to test that event1 + is not processed --> + +<scxml initial="final" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + <final id="final"> + <onentry> + <raise event="event1"/> + </onentry> + </final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test483.txml b/test/samples/w3c/txml/test483.txml new file mode 100644 index 0000000..7eab75b --- /dev/null +++ b/test/samples/w3c/txml/test483.txml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> + <!-- test that foreach works correctly, iterating over node set in document order. + This tests assertions 483-485 --> + + <scxml xmlns="http://www.w3.org/2005/07/scxml" name="scxmltest" + xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1"> + <nodes xmlns=""> + <node/> + <node/> + <node/> + </nodes> + </data> + </datamodel> + +<state id="s0"> + <onentry> + <foreach array="$var1/nodes/node" item="item" index="pos"> + <assign location="$item" type="addattribute" attr="position" expr="$pos"/> + </foreach> + </onentry> + + <transition cond="$var1/nodes/node[1]/@position = 1 and $var1/nodes/node[2]/@position = 2 and $var1/nodes/node[3]/@position = 3" conf:targetpass=""/> + <transition conf:targetfail=""/> + </state> + +<conf:pass/> +<conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test513.txml b/test/samples/w3c/txml/test513.txml new file mode 100644 index 0000000..65dda29 --- /dev/null +++ b/test/samples/w3c/txml/test513.txml @@ -0,0 +1,54 @@ +<?xml version="1.0"?> + +<!-- test that we get an HTTP success code back on successful delivery. To run this test, implementations +must support an extension to send: if the parameter httpResponse is present with value 'true', then when +the processor gets an http response code back, it must raise an event 'http.n1.nrest' where 'ni' is +the first digit of the response code and 'nrest' are the remaining digits--> + +<scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + +<state id="s0" initial="s01"> + <datamodel> + <data conf:id="1"/> + </datamodel> + + <onentry> + <send event="timeout" delay="30s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <!-- child script. Once we're running send childRunning to parent and include basicHTTPAccess URI --> + <scxml initial="child0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + <state id="child0"> + <onentry> + <send target="#_parent" event="childRunning"> + <param name="uri" conf:basicHTTPAccessURI=""/> + </send> + </onentry> + </state> + </scxml> + </content> + </invoke> + + <transition event="*" conf:targetfail=""/> + + <state id="s01"> + <!-- when we get the event from the child, extract the access uri and use + the basicHTTP event i/o processor to send it an event --> + <transition event="childRunning" target="s02"> + <assign conf:location="1" conf:eventDataFieldValue="uri"/> + <send event="test" conf:targetExpr="1" httpResponse="true" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </transition> + </state> + + <state id="s02"> + <!-- the child should send this back automatically. It does not need to take + any transition on the event --> + <transition event="HTTP.2" conf:targetpass=""/> + </state> + </state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test528.txml b/test/samples/w3c/txml/test528.txml index 69b7bb2..271bb1c 100644 --- a/test/samples/w3c/txml/test528.txml +++ b/test/samples/w3c/txml/test528.txml @@ -9,8 +9,7 @@ <transition event="error.execution" target="s1"/> <transition event="done.state.s0" conf:targetfail=""/> - <transition event="done.state.s0" conf:targetfail=""> - </transition> + <transition event="done.state.s0" conf:targetfail=""/> <state id="s01"> <transition target="s02"/> diff --git a/test/samples/w3c/xpath/test159.scxml b/test/samples/w3c/xpath/test159.scxml index 70a325d..1f2af35 100644 --- a/test/samples/w3c/xpath/test159.scxml +++ b/test/samples/w3c/xpath/test159.scxml @@ -7,7 +7,7 @@ The send tag will raise an error so var1 should not be incremented. If it is fa <state id="s0"> <onentry> <send event="thisWillFail" conf:illegaltarget=""/> - <conf:incrementId id="1"/> + <assign location="$Var1" expr="$Var1 + 1"/> </onentry> <transition cond="$Var1/text() =1" target="fail"/> <transition target="pass"/> diff --git a/test/samples/w3c/xpath/test191.scxml b/test/samples/w3c/xpath/test191.scxml index 25862ac..1910eaf 100644 --- a/test/samples/w3c/xpath/test191.scxml +++ b/test/samples/w3c/xpath/test191.scxml @@ -22,7 +22,7 @@ pass, otherwise we fail. The timer insures that some event is generated and tha </content> </invoke> <transition event="childToParent" target="pass"/> - <transition event="*" target="pass"/> + <transition event="*" target="fail"/> </state> <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> diff --git a/test/samples/w3c/xpath/test354.scxml b/test/samples/w3c/xpath/test354.scxml new file mode 100644 index 0000000..93d768d --- /dev/null +++ b/test/samples/w3c/xpath/test354.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that event.data can be populated using both namelist, param and <content> +and that correct values are used --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> +<datamodel> + <data id="Var1" expr="1"/> + <data id="Var2"/> + <data id="Var3"/> + </datamodel> + +<state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" namelist="Var1"> + <param name="param1" expr="2"/> + </send> + </onentry> + <transition event="event1" target="s1"> + <assign location="$Var2" expr="$_event/data/data[@id='Var1']/data/text()"/> + <assign location="$Var3" expr="$_event/data/data[@id='param1']/text()"/> + </transition> + <transition event="*" target="fail"> + </transition> + +</state> + +<state id="s1"> + + <transition cond="$Var2/text() =1" target="s2"/> + <transition target="fail"/> + </state> + +<state id="s2"> + <transition cond="$Var3/text() =2" target="s3"/> + <transition target="fail"/> + </state> + +<state id="s3"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event2"> + <content>foo</content> + </send> + </onentry> + <transition event="event2" cond="$_event/data = 'foo'" target="pass"/> + <transition event="*" 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>
\ No newline at end of file diff --git a/test/samples/w3c/xpath/test415.scxml b/test/samples/w3c/xpath/test415.scxml new file mode 100644 index 0000000..2da0bef --- /dev/null +++ b/test/samples/w3c/xpath/test415.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- Test that the state machine halts when it enters a top-level final state. Since + the initial state is a final state, this machine should halt immediately without + processing "event1" which is raised in the final state's on-entry handler. This + is a manual test since there is no platform-independent way to test that event1 + is not processed --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="xpath"> + <final id="final"> + <onentry> + <raise event="event1"/> + </onentry> + </final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/xpath/test483.scxml b/test/samples/w3c/xpath/test483.scxml new file mode 100644 index 0000000..0a1b236 --- /dev/null +++ b/test/samples/w3c/xpath/test483.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that foreach works correctly, iterating over node set in document order. + This tests assertions 483-485 --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1"> + <nodes xmlns=""> + <node/> + <node/> + <node/> + </nodes> + </data> + </datamodel> + +<state id="s0"> + <onentry> + <foreach array="$var1/nodes/node" item="item" index="pos"> + <assign location="$item" type="addattribute" attr="position" expr="$pos"/> + </foreach> + </onentry> + + <transition cond="$var1/nodes/node[1]/@position = 1 and $var1/nodes/node[2]/@position = 2 and $var1/nodes/node[3]/@position = 3" 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>
\ No newline at end of file diff --git a/test/samples/w3c/xpath/test513.scxml b/test/samples/w3c/xpath/test513.scxml new file mode 100644 index 0000000..bc29bb4 --- /dev/null +++ b/test/samples/w3c/xpath/test513.scxml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that we get an HTTP success code back on successful delivery. To run this test, implementations +must support an extension to send: if the parameter httpResponse is present with value 'true', then when +the processor gets an http response code back, it must raise an event 'http.n1.nrest' where 'ni' is +the first digit of the response code and 'nrest' are the remaining digits--><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="xpath" version="1.0"> + +<state id="s0" initial="s01"> + <datamodel> + <data id="Var1"/> + </datamodel> + + <onentry> + <send event="timeout" delay="30s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <!-- child script. Once we're running send childRunning to parent and include basicHTTPAccess URI --> + <scxml initial="child0" datamodel="xpath" version="1.0"> + <state id="child0"> + <onentry> + <send target="#_parent" event="childRunning"> + <param name="uri" expr="_ioprocessors/processor[@name="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"]/location/text()"/> + </send> + </onentry> + </state> + </scxml> + </content> + </invoke> + + <transition event="*" target="fail"/> + + <state id="s01"> + <!-- when we get the event from the child, extract the access uri and use + the basicHTTP event i/o processor to send it an event --> + <transition event="childRunning" target="s02"> + <assign location="$Var1" expr="$_event/data/data[@id='uri']/text()"/> + <send event="test" targetexpr="$Var1" httpResponse="true" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </transition> + </state> + + <state id="s02"> + <!-- the child should send this back automatically. It does not need to take + any transition on the event --> + <transition event="HTTP.2" target="pass"/> + </state> + </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 diff --git a/test/samples/w3c/xpath/test528.scxml b/test/samples/w3c/xpath/test528.scxml index 7cc88f7..f8f8416 100644 --- a/test/samples/w3c/xpath/test528.scxml +++ b/test/samples/w3c/xpath/test528.scxml @@ -6,8 +6,7 @@ <transition event="error.execution" target="s1"/> <transition event="done.state.s0" target="fail"/> - <transition event="done.state.s0" target="fail"> - </transition> + <transition event="done.state.s0" target="fail"/> <state id="s01"> <transition target="s02"/> diff --git a/test/src/test-arabica-xpath.cpp b/test/src/test-arabica-xpath.cpp index ced1de3..408cc2b 100644 --- a/test/src/test-arabica-xpath.cpp +++ b/test/src/test-arabica-xpath.cpp @@ -52,7 +52,7 @@ public: virtual Arabica::XPath::XPathValue<string_type, string_adaptor> resolveVariable(const string_type& /* namespace_uri */, const string_type& name) const { using namespace Arabica::XPath; - typename VarMap::const_iterator n = map_.find(name); + VarMap::const_iterator n = map_.find(name); if(n == map_.end()) throw UnboundVariableException(string_adaptor::asStdString(name)); return XPathValue<string_type, string_adaptor>(new StringValue<string_type, string_adaptor>((*n).second)); diff --git a/test/src/test-datamodel.cpp b/test/src/test-datamodel.cpp index b0ed107..773fe7f 100644 --- a/test/src/test-datamodel.cpp +++ b/test/src/test-datamodel.cpp @@ -19,7 +19,8 @@ int main(int argc, char** argv) { WSAStartup(MAKEWORD(2, 2), &wsaData); #endif - DataModel dm(Factory::getInstance()->createDataModel("ecmascript", NULL)); + Interpreter interpreter = Interpreter::fromXML("<scxml></scxml>"); + DataModel dm(Factory::getInstance()->createDataModel("ecmascript", interpreter.getImpl().get())); dm.evalAsString("var foo = 12"); { diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index f18b339..1600c27 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -98,8 +98,11 @@ void printUsageAndExit() { class W3CStatusMonitor : public uscxml::InterpreterMonitor { void beforeCompletion(uscxml::Interpreter interpreter) { Arabica::XPath::NodeSet<std::string> config = interpreter.getConfiguration(); - if (config.size() == 1 && boost::iequals(ATTR(config[0], "id"), "pass")) + if (config.size() == 1 && boost::iequals(ATTR(config[0], "id"), "pass")) { + std::cout << "TEST SUCCEEDED" << std::endl; exit(EXIT_SUCCESS); + } + std::cout << "TEST FAILED" << std::endl; exit(EXIT_FAILURE); } }; |