diff options
Diffstat (limited to 'test')
80 files changed, 1004 insertions, 165 deletions
diff --git a/test/src/test-lifecycle.cpp b/test/src/test-lifecycle.cpp index 09341a3..d28d1a5 100644 --- a/test/src/test-lifecycle.cpp +++ b/test/src/test-lifecycle.cpp @@ -99,31 +99,176 @@ int main(int argc, char** argv) { google::InitGoogleLogging(argv[0]); google::LogToStderr(); - - Interpreter interpreter = Interpreter::fromURI("/Users/sradomski/Documents/TK/Code/uscxml/test/w3c/ecma/test207.scxml"); InterpreterState state; - do { - state = interpreter.step(true); - switch (state) { - case uscxml::FINISHED: - std::cout << "FINISHED" << std::endl; - break; - case uscxml::INIT_FAILED: - std::cout << "INIT_FAILED" << std::endl; - break; - case uscxml::NOTHING_TODO: - std::cout << "NOTHING_TODO" << std::endl; - break; - case uscxml::INTERRUPTED: - std::cout << "INTERRUPTED" << std::endl; - break; - case uscxml::PROCESSED: - std::cout << "PROCESSED" << std::endl; - break; - default: - break; - } - } while(state != FINISHED); + + if (1) { + // syntactic xml parse error + const char* xml = "<invalid>"; + Interpreter interpreter = Interpreter::fromXML(xml); + state = interpreter.getState(); + assert(!interpreter); + assert(state == uscxml::InterpreterState::USCXML_FAULTED); + std::cout << interpreter.getState() << std::endl; + } + + if (1) { + // semantic xml parse error + const char* xml = "<invalid />"; + Interpreter interpreter = Interpreter::fromXML(xml); + state = interpreter.getState(); + assert(state == uscxml::InterpreterState::USCXML_INSTANTIATED); + + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FAULTED); + std::cout << interpreter.getState() << std::endl; + } + + if (1) { + // single macrostep, multiple runs + const char* xml = + "<scxml>" + " <state id=\"start\">" + " <transition target=\"done\" />" + " </state>" + " <final id=\"done\" />" + "</scxml>"; + + Interpreter interpreter = Interpreter::fromXML(xml); + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + interpreter.reset(); + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + interpreter.reset(); + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + interpreter.reset(); + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + } + + if (1) { + // two microsteps + const char* xml = + "<scxml>" + " <state id=\"start\">" + " <transition target=\"s2\" />" + " </state>" + " <state id=\"s2\">" + " <transition target=\"done\" />" + " </state>" + " <final id=\"done\" />" + "</scxml>"; + + Interpreter interpreter = Interpreter::fromXML(xml); + + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + } + + if (0) { + // macrostep in between + const char* xml = + "<scxml>" + " <state id=\"start\">" + " <onentry>" + " <send event=\"continue\" delay=\"2s\"/>" + " </onentry>" + " <transition target=\"s2\" event=\"continue\" />" + " </state>" + " <state id=\"s2\">" + " <transition target=\"done\" />" + " </state>" + " <final id=\"done\" />" + "</scxml>"; + + Interpreter interpreter = Interpreter::fromXML(xml); + + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); + assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + interpreter.reset(); + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); + assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + } + + if (1) { + // macrostep in between, external event + const char* xml = + "<scxml>" + " <state id=\"start\">" + " <transition target=\"s2\" event=\"continue\" />" + " </state>" + " <state id=\"s2\">" + " <transition target=\"done\" />" + " </state>" + " <final id=\"done\" />" + "</scxml>"; + + Interpreter interpreter = Interpreter::fromXML(xml); + + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); + interpreter.receive(Event("continue")); + assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + interpreter.reset(); + assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); + interpreter.receive(Event("continue")); + assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); + assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); + } + + if (1) { + // macrostep in between, external event + const char* xml = + "<scxml>" + " <state id=\"start\">" + " <transition target=\"s2\" event=\"continue\" />" + " </state>" + " <state id=\"s2\">" + " <transition target=\"done\" />" + " </state>" + " <final id=\"done\" />" + "</scxml>"; + + Interpreter interpreter = Interpreter::fromXML(xml); + interpreter.start(); + // assume interpreter is started + assert(interpreter.getState() & InterpreterState::USCXML_THREAD_STARTED); + tthread::this_thread::sleep_for(tthread::chrono::milliseconds(100)); + + // assume it is started and running + std::cout << interpreter.getState() << std::endl; + + assert(interpreter.getState() & InterpreterState::USCXML_THREAD_STARTED); + assert(interpreter.getState() & InterpreterState::USCXML_THREAD_RUNNING); + assert(interpreter.getState() & InterpreterState::USCXML_IDLE); + + interpreter.receive(Event("continue")); + tthread::this_thread::sleep_for(tthread::chrono::milliseconds(200)); + + std::cout << interpreter.getState() << std::endl; + int state = interpreter.getState(); + assert(state & InterpreterState::USCXML_FINISHED); + assert(!(state & InterpreterState::USCXML_THREAD_STARTED)); + assert(!(state & InterpreterState::USCXML_THREAD_RUNNING)); + + } + return EXIT_SUCCESS; }
\ No newline at end of file diff --git a/test/src/test-predicates.cpp b/test/src/test-predicates.cpp index 00be408..3e3c278 100644 --- a/test/src/test-predicates.cpp +++ b/test/src/test-predicates.cpp @@ -15,17 +15,17 @@ int main(int argc, char** argv) { Interpreter interpreter = Interpreter::fromURI(argv[1]); assert(interpreter); - Node<std::string> atomicState = interpreter.getState("atomic"); + Node<std::string> atomicState = interpreter.getImpl()->getState("atomic"); assert(InterpreterImpl::isAtomic(atomicState)); assert(!InterpreterImpl::isParallel(atomicState)); assert(!InterpreterImpl::isCompound(atomicState)); - Node<std::string> compoundState = interpreter.getState("compound"); + Node<std::string> compoundState = interpreter.getImpl()->getState("compound"); assert(!InterpreterImpl::isAtomic(compoundState)); assert(!InterpreterImpl::isParallel(compoundState)); assert(InterpreterImpl::isCompound(compoundState)); - Node<std::string> parallelState = interpreter.getState("parallel"); + Node<std::string> parallelState = interpreter.getImpl()->getState("parallel"); assert(!InterpreterImpl::isAtomic(parallelState)); assert(InterpreterImpl::isParallel(parallelState)); assert(!InterpreterImpl::isCompound(parallelState)); // parallel states are not compound! @@ -34,12 +34,12 @@ int main(int argc, char** argv) { assert(initialState[0] == atomicState); NodeSet<std::string> childs = interpreter.getImpl()->getChildStates(compoundState); - Node<std::string> compoundChild1 = interpreter.getState("compoundChild1"); - Node<std::string> compoundChild2 = interpreter.getState("compoundChild2"); + Node<std::string> compoundChild1 = interpreter.getImpl()->getState("compoundChild1"); + Node<std::string> compoundChild2 = interpreter.getImpl()->getState("compoundChild2"); assert(childs.size() > 0); - assert(Interpreter::isMember(compoundChild1, childs)); - assert(Interpreter::isMember(compoundChild2, childs)); - assert(!Interpreter::isMember(compoundState, childs)); + assert(InterpreterImpl::isMember(compoundChild1, childs)); + assert(InterpreterImpl::isMember(compoundChild2, childs)); + assert(!InterpreterImpl::isMember(compoundState, childs)); assert(InterpreterImpl::isDescendant(compoundChild1, compoundState)); diff --git a/test/w3c/confEcma.xsl b/test/w3c/confEcma.xsl index 61d48c6..96c1708 100644 --- a/test/w3c/confEcma.xsl +++ b/test/w3c/confEcma.xsl @@ -66,6 +66,11 @@ <xsl:attribute name="location">Var<xsl:value-of select="." /></xsl:attribute> </xsl:template> +<!-- names an invalid location for <assign>, etc. --> +<xsl:template match="//@conf:invalidLocation"> + <xsl:attribute name="location">foo.bar.baz </xsl:attribute> +</xsl:template> + <!-- uses system var as location for <assign>, etc. --> <xsl:template match="//@conf:systemVarLocation"> <xsl:attribute name="location"><xsl:value-of select="." /></xsl:attribute> @@ -210,7 +215,7 @@ </xsl:template> <!-- returns the value of a KVP specified by <param> from _event.data --> <xsl:template match="//@conf:eventDataNamelistValue"> - <xsl:attribute name="expr">_event.data.<xsl:value-of select="."/></xsl:attribute> + <xsl:attribute name="expr">_event.data.Var<xsl:value-of select="."/></xsl:attribute> </xsl:template> <!-- returns the location of the scxml event i/o processor --> @@ -412,7 +417,7 @@ is the second argument --> <!-- return true if event.data field matches the specified value --> <xsl:template match="//@conf:eventdataVal"> - <xsl:attribute name="cond">_event.data === '<xsl:value-of select="."/>'</xsl:attribute> + <xsl:attribute name="cond">_event.data == <xsl:value-of select="."/></xsl:attribute> </xsl:template> <xsl:template match="//@conf:emptyEventData"> diff --git a/test/w3c/confXPath.xsl b/test/w3c/confXPath.xsl index 514752a..fa67f3b 100644 --- a/test/w3c/confXPath.xsl +++ b/test/w3c/confXPath.xsl @@ -66,6 +66,11 @@ <xsl:attribute name="location">$Var<xsl:value-of select="." /></xsl:attribute> </xsl:template> +<!-- names an invalid location for <assign>, etc. --> +<xsl:template match="//@conf:invalidLocation"> + <xsl:attribute name="location">foo.bar.baz </xsl:attribute> +</xsl:template> + <!-- uses system var as location for <assign>, etc. --> <xsl:template match="//@conf:systemVarLocation"> <xsl:attribute name="location">$<xsl:value-of select="." /></xsl:attribute> @@ -293,7 +298,7 @@ is of the same type as array123 --> <!-- returns the value of a KVP specified by Namelist from _event.data --> <xsl:template match="//@conf:eventDataNamelistValue"> - <xsl:attribute name="expr">$_event/data/data[@id='<xsl:value-of select="."/>']/data/text()</xsl:attribute> + <xsl:attribute name="expr">$_event/data/data[@id=Var'<xsl:value-of select="."/>']/data/text()</xsl:attribute> </xsl:template> <!-- returns the location of the scxml event i/o processor --> @@ -498,7 +503,7 @@ is the second argument --> <!-- return true if event.data field matches the specified value --> <xsl:template match="//@conf:eventdataVal"> - <xsl:attribute name="cond">$_event/data = '<xsl:value-of select="."/>'</xsl:attribute> + <xsl:attribute name="cond">$_event/data = <xsl:value-of select="."/></xsl:attribute> </xsl:template> <xsl:template match="//@conf:emptyEventData"> diff --git a/test/w3c/ecma/test179.scxml b/test/w3c/ecma/test179.scxml index 170b105..f5c9169 100644 --- a/test/w3c/ecma/test179.scxml +++ b/test/w3c/ecma/test179.scxml @@ -8,7 +8,7 @@ </send> </onentry> - <transition event="event1" cond="_event.data === '123'" target="pass"/> + <transition event="event1" cond="_event.data == 123" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/w3c/ecma/test193.scxml b/test/w3c/ecma/test193.scxml index 441a658..286513d 100644 --- a/test/w3c/ecma/test193.scxml +++ b/test/w3c/ecma/test193.scxml @@ -1,17 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?><!-- we test that omitting target and targetexpr of <send> when using the -basichttp event i/o processor puts error.communication on the internal queue. --><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"> +SCXML event i/o processor puts the event on the external queue. --><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"> <state id="s0"> <onentry> - <!-- this should put an error in the internal queue --> - <send event="event1" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> - <send event="fail"/> + <send event="internal"/> + <!-- this should put event1 in the external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="timeout" delay="1s"/> </onentry> - <transition event="error.communication" target="pass"/> - <transition event="*" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="internal" target="s1"/> </state> + + <state id="s1"> + <transition event="event1" target="pass"/> + <transition event="timeout" 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> diff --git a/test/w3c/ecma/test233.scxml b/test/w3c/ecma/test233.scxml index 3900d28..1e07c20 100644 --- a/test/w3c/ecma/test233.scxml +++ b/test/w3c/ecma/test233.scxml @@ -26,7 +26,7 @@ the transtitions. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf </finalize> </invoke> - <transition event="childToParent" cond="" target="pass"/> + <transition event="childToParent" cond="Var1==2" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/w3c/ecma/test286.scxml b/test/w3c/ecma/test286.scxml index 596f2ba..1c4c6bd 100644 --- a/test/w3c/ecma/test286.scxml +++ b/test/w3c/ecma/test286.scxml @@ -4,7 +4,7 @@ where no error is raised --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns <state id="s0"> <onentry> - <assign location="Var1" expr="1"/> + <assign location="foo.bar.baz " expr="1"/> <raise event="foo"/> </onentry> diff --git a/test/w3c/ecma/test294.scxml b/test/w3c/ecma/test294.scxml index efd26f4..fea1d8c 100644 --- a/test/w3c/ecma/test294.scxml +++ b/test/w3c/ecma/test294.scxml @@ -24,7 +24,7 @@ that content inside donedata sets the full value of the event.data field --><scx <state id="s1" initial="s11"> - <transition event="done.state.s1" cond="_event.data === 'foo'" target="pass"> + <transition event="done.state.s1" cond="_event.data == 'foo'" target="pass"> </transition> <transition event="done.state.s1" target="fail"> diff --git a/test/w3c/ecma/test298.scxml b/test/w3c/ecma/test298.scxml index 6a82a95..38c0e6d 100644 --- a/test/w3c/ecma/test298.scxml +++ b/test/w3c/ecma/test298.scxml @@ -1,9 +1,13 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- refence a non-existent data model location in param in donedata and see that the right error is raised --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="ecmascript" initial="s0"> +<?xml version="1.0" encoding="UTF-8"?><!-- reference a non-existent data model location in param in donedata and see that the right error is raised --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="ecmascript" initial="s0"> <datamodel> <data id="Var1" expr="0"/> </datamodel> <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="error.execution" target="pass"/> <transition event="*" target="fail"/> @@ -12,7 +16,7 @@ </state> <final id="s02"> <donedata> - <param name="Var3" location="Var2"/> + <param name="Var3" location="foo.bar.baz "/> </donedata> </final> </state> diff --git a/test/w3c/ecma/test311.scxml b/test/w3c/ecma/test311.scxml index 851f3ad..9398c38 100644 --- a/test/w3c/ecma/test311.scxml +++ b/test/w3c/ecma/test311.scxml @@ -3,7 +3,8 @@ <state id="s0"> <onentry> - <assign location="Var1" expr="1"/> + <send event="timeout" delay="1s"/> + <assign location="foo.bar.baz " expr="1"/> </onentry> <transition event="error.execution" target="pass"/> <transition event=".*" target="fail"/> diff --git a/test/w3c/ecma/test329.scxml b/test/w3c/ecma/test329.scxml index 9a95643..586f15a 100644 --- a/test/w3c/ecma/test329.scxml +++ b/test/w3c/ecma/test329.scxml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?><!-- test that none of the system variables can be modified --><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" name="machineName"> + <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" /> <datamodel> <data id="Var1"/> <data id="Var2"/> diff --git a/test/w3c/ecma/test330.scxml b/test/w3c/ecma/test330.scxml index 5cbf4bc..5488f96 100644 --- a/test/w3c/ecma/test330.scxml +++ b/test/w3c/ecma/test330.scxml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- check that the required fields are present in both internal and external events --><scxml xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" name="machineName"> +<?xml version="1.0" encoding="UTF-8"?><!-- check that the required fields are present in both internal and external events --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" name="machineName"> <state id="s0"> <onentry> @@ -17,7 +17,7 @@ </state> - <final xmlns="http://www.w3.org/2005/07/scxml" id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> - <final xmlns="http://www.w3.org/2005/07/scxml" id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + <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/w3c/ecma/test331.scxml b/test/w3c/ecma/test331.scxml index e1271f0..82272ea 100644 --- a/test/w3c/ecma/test331.scxml +++ b/test/w3c/ecma/test331.scxml @@ -24,7 +24,7 @@ <state id="s2"> <onentry> <!-- this will generate an error, which is a platform event --> - <assign location="Var2" expr="1"/> + <assign location="foo.bar.baz " expr="1"/> </onentry> <transition event="error" target="s3"> <assign location="Var1" expr="_event.type"/> @@ -54,7 +54,7 @@ </state> - <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> - <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + <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/w3c/ecma/test350.scxml b/test/w3c/ecma/test350.scxml deleted file mode 100644 index b401ab1..0000000 --- a/test/w3c/ecma/test350.scxml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- test that target value is used to decide what session to deliver the event to. A session should be -able to send an event to itself using its own session ID as the target --><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"> -<datamodel> - <data id="Var1" expr="'#_scxml_' + _sessionid"/> - </datamodel> - -<state id="s0"> - - <onentry> - <send delay="5s" event="timeout"/> - <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" targetexpr="Var1" event="s0Event"/> - </onentry> - <transition event="s0Event" 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/w3c/ecma/test354.scxml b/test/w3c/ecma/test354.scxml index 3a3c33b..ef55794 100644 --- a/test/w3c/ecma/test354.scxml +++ b/test/w3c/ecma/test354.scxml @@ -40,7 +40,7 @@ and that correct values are used --><scxml xmlns="http://www.w3.org/2005/07/scxm <content>foo</content> </send> </onentry> - <transition event="event2" cond="_event.data === 'foo'" target="pass"/> + <transition event="event2" cond="_event.data == 'foo'" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/w3c/ecma/test401.scxml b/test/w3c/ecma/test401.scxml index 9ce7217..d5f0545 100644 --- a/test/w3c/ecma/test401.scxml +++ b/test/w3c/ecma/test401.scxml @@ -7,7 +7,7 @@ it was raised second --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:co <onentry> <send event="foo"/> <!-- assigning to a non-existent location should raise an error --> - <assign location="Var1" expr="2"/> + <assign location="foo.bar.baz " expr="2"/> </onentry> diff --git a/test/w3c/ecma/test402.scxml b/test/w3c/ecma/test402.scxml index 104483d..969256e 100644 --- a/test/w3c/ecma/test402.scxml +++ b/test/w3c/ecma/test402.scxml @@ -14,7 +14,7 @@ are pulled off the internal queue in order, and that prefix matching works on th <!-- the first internal event. The error will be the second, and event2 will be the third --> <raise event="event1"/> <!-- assigning to a non-existent location should raise an error --> - <assign location="Var1" expr="2"/> + <assign location="foo.bar.baz " expr="2"/> </onentry> <transition event="event1" target="s02"> diff --git a/test/w3c/ecma/test446.scxml b/test/w3c/ecma/test446.scxml new file mode 100644 index 0000000..0fa8698 --- /dev/null +++ b/test/w3c/ecma/test446.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that if the child of <data> is JSON, the processor + assigns it as the value of the var --><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">[1, 2, 3]</data> + <data id="var2" src="file:test458.txt"/> + </datamodel> + +<state id="s0"> + <transition cond="var1 instanceof Array" target="s1"/> + <transition target="fail"/> + </state> + +<state id="s1"> + <transition cond="var2 instanceof Array" 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/w3c/ecma/test458.txt b/test/w3c/ecma/test458.txt new file mode 100644 index 0000000..6001c44 --- /dev/null +++ b/test/w3c/ecma/test458.txt @@ -0,0 +1 @@ +[1, 2, 3]
\ No newline at end of file diff --git a/test/w3c/ecma/test459.scxml b/test/w3c/ecma/test459.scxml new file mode 100644 index 0000000..b631c25 --- /dev/null +++ b/test/w3c/ecma/test459.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that foreach goes over the array in the right order. since the array contains 1 2 3, we compare the current +value with the previous value, which is stored in var1. The current value should always be larger. If +it ever isn't, set Var4 to 0, indicating failure. Also check that the final value of the index +is 2 (meaning that the initial value was 0, not 1) --><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="0"/> <!-- contains the previous value --> + <data id="Var2"/> <!-- the item which will contain the current value --> + <data id="Var3"/> <!-- the index --> + <data id="Var4" expr="[1,2,3]"/> + <data id="Var5" expr="1"/> <!-- 1 if success, 0 if failure --> + </datamodel> + + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var4" index="Var3"> + <if cond="Var1<Var2"> + <assign location="Var1" expr="Var2"/> + <else/> + <!-- values are out of order, record failure --> + <assign location="Var5" expr="0"/> + </if> + </foreach> + </onentry> + + <!-- check that var1 has its original value --> + <transition cond="Var4==0 | Var3 != 2" target="fail"/> + <transition target="pass"/> + </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/w3c/ecma/test496.scxml b/test/w3c/ecma/test496.scxml new file mode 100644 index 0000000..28c79a5 --- /dev/null +++ b/test/w3c/ecma/test496.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?><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"> + + +<state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="event" target="#_scxml_foo"/> + <raise event="foo"/> + </onentry> + <transition event="error.communication" 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/w3c/ecma/test527.scxml b/test/w3c/ecma/test527.scxml index 426cc6c..623495a 100644 --- a/test/w3c/ecma/test527.scxml +++ b/test/w3c/ecma/test527.scxml @@ -3,7 +3,7 @@ <state id="s0" initial="s01"> - <transition event="done.state.s0" cond="_event.data === 'foo'" target="pass"> + <transition event="done.state.s0" cond="_event.data == 'foo'" target="pass"> </transition> <transition event="done.state.s0" target="fail"> diff --git a/test/w3c/ecma/test528.scxml b/test/w3c/ecma/test528.scxml index f0e8911..891215f 100644 --- a/test/w3c/ecma/test528.scxml +++ b/test/w3c/ecma/test528.scxml @@ -6,7 +6,6 @@ <transition event="error.execution" target="s1"/> <transition event="done.state.s0" target="fail"/> - <transition event="done.state.s0" target="fail"/> <state id="s01"> <transition target="s02"/> diff --git a/test/w3c/ecma/test529.scxml b/test/w3c/ecma/test529.scxml index 91dc002..0ef20c4 100644 --- a/test/w3c/ecma/test529.scxml +++ b/test/w3c/ecma/test529.scxml @@ -3,7 +3,7 @@ <state id="s0" initial="s01"> - <transition event="done.state.s0" cond="_event.data === '21'" target="pass"> + <transition event="done.state.s0" cond="_event.data == 21" target="pass"> </transition> <transition event="done.state.s0" target="fail"> diff --git a/test/w3c/ecma/test545.scxml b/test/w3c/ecma/test545.scxml new file mode 100644 index 0000000..1e12770 --- /dev/null +++ b/test/w3c/ecma/test545.scxml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that xml content in send is place as XML under event/data --><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"> + +<state id="s0"> + <onentry> + <send event="someevent"> + <content><foo xmlns=""><bar>3</bar></foo></content> + </send> + </onentry> + + <transition event="*" cond="$_event/data/foo/bar = 3" 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/w3c/ecma/test561.scxml b/test/w3c/ecma/test561.scxml index e50e00c..e94a813 100644 --- a/test/w3c/ecma/test561.scxml +++ b/test/w3c/ecma/test561.scxml @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that processor creates an ECMAScript object - _event.data when receiving JSON in an event --><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"> +<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that processor creates an ECMAScript DOM object + _event.data when receiving XML in an event --><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"> <state id="s0"> diff --git a/test/w3c/ecma/test577.scxml b/test/w3c/ecma/test577.scxml new file mode 100644 index 0000000..d115e88 --- /dev/null +++ b/test/w3c/ecma/test577.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that <send> without target in basichttp event i/o processor +causes error.communication to get added to internal queue . --><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"> + <onentry> + <!-- sent by scxml event i/o processor, added to external queue --> + <send event="event1"/> + <!-- should put error.communication on internal queue --> + <send event="test" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + + </onentry> + + + <transition event="error.communication" 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/w3c/ecma/test578.scxml b/test/w3c/ecma/test578.scxml index bdb5e2d..9a25195 100644 --- a/test/w3c/ecma/test578.scxml +++ b/test/w3c/ecma/test578.scxml @@ -5,7 +5,7 @@ <state id="s0"> <onentry> <send event="foo"> - <content>{ productName : "bar", size : 27 }</content> + <content>{ "productName" : "bar", "size" : 27 }</content> </send> </onentry> <transition event="foo" cond="_event.data.productName == 'bar'" target="pass"/> diff --git a/test/w3c/ecma/test579.scxml b/test/w3c/ecma/test579.scxml new file mode 100644 index 0000000..f89b1a9 --- /dev/null +++ b/test/w3c/ecma/test579.scxml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that default history content is executed correctly. The Process MUST execute any executable content in the transition after the parent state's onentry handlers, and, in the case where the history pseudo-state is the target of an <initial> transition, +the executable content inside the <initial> transition. However the Processor MUST +execute this content only if there is no stored history. Once the history state's +parent state has been visited and exited, the default history content must not be executed --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="ecmascript"> + + +<state id="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <initial> + <transition target="sh1"> + <raise event="event2"/> + </transition> + </initial> + <onentry> + <send delay="2s" event="timeout"/> + <raise event="event1"/> + </onentry> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <history id="sh1"> + <transition target="s01"> + <raise event="event3"/> + </transition> + </history> + + <state id="s01"> + <transition event="event1" target="s02"/> + <transition event="*" target="fail"/> + </state> + + <state id="s02"> + <transition event="event2" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + + <transition cond="Var1==0" event="event3" target="s0"/> + <transition cond="Var1==1" event="event1" target="s2"/> + <transition event="*" target="fail"/> + </state> +</state> + +<state id="s2"> + <transition event="event2" target="s3"/> + <transition event="*" target="fail"/> + + </state> + +<state id="s3"> + <transition event="event3" target="fail"/> + <transition event="timeout" target="pass"/> + </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/w3c/ecma/test580.scxml b/test/w3c/ecma/test580.scxml new file mode 100644 index 0000000..4c4d522 --- /dev/null +++ b/test/w3c/ecma/test580.scxml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that a history state never ends up part of the configuration --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="p1" datamodel="ecmascript"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + +<parallel id="p1"> + <onentry> + <send delay="2s" event="timeout"/> + </onentry> + + + <state id="s0"> + <transition cond="In('sh1')" target="fail"/> + <transition event="timeout" target="fail"/> + </state> + + +<state id="s1"> + <initial> + <transition target="sh1"/> + </initial> + + + <history id="sh1"> + <transition target="s11"/> + </history> + + <state id="s11"> + <transition cond="In('sh1')" target="fail"/> + <transition target="s12"/> + </state> + + <state id="s12"/> + <transition cond="In('sh1')" target="fail"/> + <transition cond="Var1==0" target="sh1"/> + <transition cond="Var1==1" target="pass"/> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + </state> + + + </parallel> + +<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/w3c/txml/test159.txml b/test/w3c/txml/test159.txml index b7245c0..f4340b3 100644 --- a/test/w3c/txml/test159.txml +++ b/test/w3c/txml/test159.txml @@ -10,7 +10,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=""/> + <send event="thisWillFail" conf:illegalTarget=""/> <conf:incrementID id="1"/> </onentry> <transition conf:idVal="1=1" conf:targetfail=""/> diff --git a/test/w3c/txml/test193.txml b/test/w3c/txml/test193.txml index ba1598b..24cb2ac 100644 --- a/test/w3c/txml/test193.txml +++ b/test/w3c/txml/test193.txml @@ -1,20 +1,27 @@ <?xml version="1.0"?> <!-- we test that omitting target and targetexpr of <send> when using the -basichttp event i/o processor puts error.communication on the internal queue. --> +SCXML event i/o processor puts the event on the external queue. --> <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"> <state id="s0"> <onentry> - <!-- this should put an error in the internal queue --> - <send event="event1" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> - <send event="fail"/> + <send event="internal"/> + <!-- this should put event1 in the external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="timeout" delay="1s"/> </onentry> - <transition event="error.communication" conf:targetpass=""/> - <transition event="*" conf:targetfail=""/> + <transition event="event1" conf:targetfail=""/> + <transition event="internal" target="s1"/> </state> + + <state id="s1"> + <transition event="event1" conf:targetpass=""/> + <transition event="timeout" conf:targetfail=""/> + + </state> <conf:pass/> <conf:fail/> diff --git a/test/w3c/txml/test233.txml b/test/w3c/txml/test233.txml index 94b219b..8f186fd 100644 --- a/test/w3c/txml/test233.txml +++ b/test/w3c/txml/test233.txml @@ -30,7 +30,7 @@ the transtitions. --> </finalize> </invoke> - <transition event="childToParent" conf:idVal="1 2" conf:targetpass=""/> + <transition event="childToParent" conf:idVal="1=2" conf:targetpass=""/> <transition event="*" conf:targetfail=""/> </state> diff --git a/test/w3c/txml/test286.txml b/test/w3c/txml/test286.txml index 89b77a9..a58f643 100644 --- a/test/w3c/txml/test286.txml +++ b/test/w3c/txml/test286.txml @@ -9,7 +9,7 @@ where no error is raised --> <state id="s0"> <onentry> - <assign conf:location="1" conf:expr="1"/> + <assign conf:invalidLocation="" conf:expr="1"/> <raise event="foo"/> </onentry> diff --git a/test/w3c/txml/test294.txml b/test/w3c/txml/test294.txml index 507ff3b..c257cec 100644 --- a/test/w3c/txml/test294.txml +++ b/test/w3c/txml/test294.txml @@ -27,7 +27,7 @@ that content inside donedata sets the full value of the event.data field --> <state id="s1" initial="s11"> - <transition event="done.state.s1" conf:eventdataVal="foo" conf:targetpass=""> + <transition event="done.state.s1" conf:eventdataVal="'foo'" conf:targetpass=""> </transition> <transition event="done.state.s1" conf:targetfail=""> diff --git a/test/w3c/txml/test298.txml b/test/w3c/txml/test298.txml index e1af350..2935099 100644 --- a/test/w3c/txml/test298.txml +++ b/test/w3c/txml/test298.txml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!-- refence a non-existent data model location in param in donedata and see that the right error is raised --> +<!-- reference a non-existent data model location in param in donedata and see that the right error is raised --> <scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" conf:datamodel="" initial="s0"> <datamodel> @@ -7,6 +7,10 @@ </datamodel> <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="error.execution" conf:targetpass=""/> <transition event="*" conf:targetfail=""/> @@ -15,7 +19,7 @@ </state> <final id="s02"> <donedata> - <param conf:name="3" conf:location="2"/> + <param conf:name="3" conf:invalidLocation=""/> </donedata> </final> </state> diff --git a/test/w3c/txml/test311.txml b/test/w3c/txml/test311.txml index f6485be..50e506a 100644 --- a/test/w3c/txml/test311.txml +++ b/test/w3c/txml/test311.txml @@ -8,7 +8,8 @@ xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0"> <state id="s0"> <onentry> - <assign conf:location="1" conf:expr="1"/> + <send event="timeout" delay="1s"/> + <assign conf:invalidLocation="" conf:expr="1"/> </onentry> <transition event="error.execution" conf:targetpass=""/> <transition event=".*" conf:targetfail=""/> diff --git a/test/w3c/txml/test330.txml b/test/w3c/txml/test330.txml index 7778fad..ca13451 100644 --- a/test/w3c/txml/test330.txml +++ b/test/w3c/txml/test330.txml @@ -2,7 +2,7 @@ <!-- check that the required fields are present in both internal and external events --> -<scxml initial="s0" conf:datamodel="" name="machineName" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<scxml initial="s0" conf:datamodel="" name="machineName" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> <state id="s0"> <onentry> diff --git a/test/w3c/txml/test331.txml b/test/w3c/txml/test331.txml index a273b14..553d2f2 100644 --- a/test/w3c/txml/test331.txml +++ b/test/w3c/txml/test331.txml @@ -26,7 +26,7 @@ <state id="s2"> <onentry> <!-- this will generate an error, which is a platform event --> - <assign conf:location="2" conf:expr="1"/> + <assign conf:invalidLocation="" conf:expr="1"/> </onentry> <transition event="error" target="s3"> <assign conf:location="1" conf:eventType=""/> @@ -56,7 +56,7 @@ </state> - <final xmlns="http://www.w3.org/2005/07/scxml" id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> - <final xmlns="http://www.w3.org/2005/07/scxml" id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + <conf:pass/> + <conf:fail/> </scxml>
\ No newline at end of file diff --git a/test/w3c/txml/test350.txml b/test/w3c/txml/test350.txml index b57e881..1086db7 100644 --- a/test/w3c/txml/test350.txml +++ b/test/w3c/txml/test350.txml @@ -5,12 +5,14 @@ able to send an event to itself using its own session ID as the target --> <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"> <datamodel> - <data conf:id="1" conf:expr="'#_scxml_' + _sessionid"/> - </datamodel> + <data conf:id="1" conf:quoteExpr="#_scxml_"/> + <data conf:id="2" conf:systemVarExpr="_sessionid”/> +</datamodel> <state id="s0"> <onentry> + <conf:concatVars id1="1" id2="2"/> <send delay="5s" event="timeout"/> <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" conf:targetVar="1" event="s0Event"/> </onentry> diff --git a/test/w3c/txml/test354.txml b/test/w3c/txml/test354.txml index d9e643a..0f1f6c5 100644 --- a/test/w3c/txml/test354.txml +++ b/test/w3c/txml/test354.txml @@ -13,12 +13,12 @@ and that correct values are used --> <state id="s0"> <onentry> <send delay="5s" event="timeout"/> - <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" namelist="Var1"> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" conf:namelist="1"> <param name="param1" conf:expr="2"/> </send> </onentry> <transition event="event1" target="s1"> - <assign conf:location="2" conf:eventDataNamelistValue="Var1"/> + <assign conf:location="2" conf:eventDataNamelistValue="1"/> <assign conf:location="3" conf:eventDataParamValue="param1"/> </transition> <transition event="*" conf:targetfail=""> @@ -44,7 +44,7 @@ and that correct values are used --> <content>foo</content> </send> </onentry> - <transition event="event2" conf:eventdataVal="foo" conf:targetpass=""/> + <transition event="event2" conf:eventdataVal="'foo'" conf:targetpass=""/> <transition event="*" conf:targetfail=""/> </state> diff --git a/test/w3c/txml/test401.txml b/test/w3c/txml/test401.txml index a42b719..9aaa506 100644 --- a/test/w3c/txml/test401.txml +++ b/test/w3c/txml/test401.txml @@ -11,7 +11,7 @@ it was raised second --> <onentry> <send event="foo"/> <!-- assigning to a non-existent location should raise an error --> - <assign conf:location="1" conf:expr="2"/> + <assign conf:invalidLocation="" conf:expr="2"/> </onentry> diff --git a/test/w3c/txml/test402.txml b/test/w3c/txml/test402.txml index 24e84e1..4e6d485 100644 --- a/test/w3c/txml/test402.txml +++ b/test/w3c/txml/test402.txml @@ -18,7 +18,7 @@ are pulled off the internal queue in order, and that prefix matching works on th <!-- the first internal event. The error will be the second, and event2 will be the third --> <raise event="event1"/> <!-- assigning to a non-existent location should raise an error --> - <assign conf:location="1" conf:expr="2"/> + <assign conf:invalidLocation="" conf:expr="2"/> </onentry> <transition event="event1" target="s02"> diff --git a/test/w3c/txml/test446.txml b/test/w3c/txml/test446.txml new file mode 100644 index 0000000..afdf6a0 --- /dev/null +++ b/test/w3c/txml/test446.txml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> + <!-- in the ECMA data model, test that if the child of <data> is JSON, the processor + assigns it as the value of the var --> + + <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">[1, 2, 3]</data> + <data id="var2" src="file:test458.txt"/> + </datamodel> + +<state id="s0"> + <transition cond="var1 instanceof Array" target="s1"/> + <transition conf:targetfail=""/> + </state> + +<state id="s1"> + <transition cond="var2 instanceof Array" conf:targetpass=""/> + <transition conf:targetfail=""/> + </state> + +<conf:pass/> +<conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/w3c/txml/test459.txml b/test/w3c/txml/test459.txml new file mode 100644 index 0000000..3cdec7b --- /dev/null +++ b/test/w3c/txml/test459.txml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that foreach goes over the array in the right order. since the array contains 1 2 3, we compare the current +value with the previous value, which is stored in var1. The current value should always be larger. If +it ever isn't, set Var4 to 0, indicating failure. Also check that the final value of the index +is 2 (meaning that the initial value was 0, not 1) --> +<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="0"/> <!-- contains the previous value --> + <data id="Var2"/> <!-- the item which will contain the current value --> + <data id="Var3"/> <!-- the index --> + <data id="Var4" expr="[1,2,3]"/> + <data id="Var5" expr="1"/> <!-- 1 if success, 0 if failure --> + </datamodel> + + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var4" index="Var3"> + <if cond="Var1<Var2"> + <assign location="Var1" expr="Var2"/> + <else/> + <!-- values are out of order, record failure --> + <assign location="Var5" expr="0"/> + </if> + </foreach> + </onentry> + + <!-- check that var1 has its original value --> + <transition cond="Var4==0 | Var3 != 2" target="fail"/> + <transition target="pass"/> + </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/w3c/txml/test496.txml b/test/w3c/txml/test496.txml new file mode 100644 index 0000000..ecd1e15 --- /dev/null +++ b/test/w3c/txml/test496.txml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> + +<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"> + + +<state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="event" conf:unreachableTarget=""/> + <raise event="foo"/> + </onentry> + <transition event="error.communication" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + </state> + + + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/w3c/txml/test527.txml b/test/w3c/txml/test527.txml index 80894a7..f97015d 100644 --- a/test/w3c/txml/test527.txml +++ b/test/w3c/txml/test527.txml @@ -6,7 +6,7 @@ <state id="s0" initial="s01"> - <transition event="done.state.s0" conf:eventdataVal="foo" conf:targetpass=""> + <transition event="done.state.s0" conf:eventdataVal="'foo'" conf:targetpass=""> </transition> <transition event="done.state.s0" conf:targetfail=""> diff --git a/test/w3c/txml/test528.txml b/test/w3c/txml/test528.txml index 271bb1c..ed70c20 100644 --- a/test/w3c/txml/test528.txml +++ b/test/w3c/txml/test528.txml @@ -9,7 +9,6 @@ <transition event="error.execution" target="s1"/> <transition event="done.state.s0" conf:targetfail=""/> - <transition event="done.state.s0" conf:targetfail=""/> <state id="s01"> <transition target="s02"/> diff --git a/test/w3c/txml/test545.txml b/test/w3c/txml/test545.txml new file mode 100644 index 0000000..d95f8f3 --- /dev/null +++ b/test/w3c/txml/test545.txml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> + <!-- test that xml content in send is place as XML under event/data --> + + <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"> + +<state id="s0"> + <onentry> + <send event="someevent"> + <content><foo xmlns=""><bar>3</bar></foo></content> + </send> + </onentry> + + <transition event="*" cond="$_event/data/foo/bar = 3" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + </state> + +<conf:pass/> +<conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/w3c/txml/test561.txml b/test/w3c/txml/test561.txml index 4b7ec8e..183cb9d 100644 --- a/test/w3c/txml/test561.txml +++ b/test/w3c/txml/test561.txml @@ -1,6 +1,6 @@ <?xml version="1.0"?> - <!-- in the ECMA data model, test that processor creates an ECMAScript object - _event.data when receiving JSON in an event --> + <!-- in the ECMA data model, test that processor creates an ECMAScript DOM object + _event.data when receiving XML in an event --> <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"> diff --git a/test/w3c/txml/test577.txml b/test/w3c/txml/test577.txml new file mode 100644 index 0000000..adf1531 --- /dev/null +++ b/test/w3c/txml/test577.txml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- test that that <send> without target in basichttp event i/o processor +causes error.communication to get added to internal queue . --> + +<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"> + <onentry> + <!-- sent by scxml event i/o processor, added to external queue --> + <send event="event1"/> + <!-- should put error.communication on internal queue --> + <send event="test" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + + </onentry> + + + <transition event="error.communication" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + </state> + + <conf:pass/> + <conf:fail/> +</scxml>
\ No newline at end of file diff --git a/test/w3c/txml/test578.txml b/test/w3c/txml/test578.txml index a4de932..cae3cdd 100644 --- a/test/w3c/txml/test578.txml +++ b/test/w3c/txml/test578.txml @@ -9,7 +9,7 @@ <state id="s0"> <onentry> <send event="foo"> - <content>{ productName : "bar", size : 27 }</content> + <content>{ "productName" : "bar", "size" : 27 }</content> </send> </onentry> <transition event="foo" cond="_event.data.productName == 'bar'" diff --git a/test/w3c/txml/test579.txml b/test/w3c/txml/test579.txml new file mode 100644 index 0000000..7c48c37 --- /dev/null +++ b/test/w3c/txml/test579.txml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<!-- test that default history content is executed correctly. The Process MUST execute any executable content in the transition after the parent state's onentry handlers, and, in the case where the history pseudo-state is the target of an <initial> transition, +the executable content inside the <initial> transition. However the Processor MUST +execute this content only if there is no stored history. Once the history state's +parent state has been visited and exited, the default history content must not be executed --> + + +<scxml version="1.0" initial="s0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + + +<state id="s0"> + <datamodel> + <data conf:id="1" conf:expr="0"/> + </datamodel> + <initial> + <transition target="sh1"> + <raise event="event2"/> + </transition> + </initial> + <onentry> + <send delay="2s" event="timeout"/> + <raise event="event1"/> + </onentry> + <onexit> + <conf:incrementID id="1"/> + </onexit> + <history id="sh1"> + <transition target="s01"> + <raise event="event3"/> + </transition> + </history> + + <state id="s01"> + <transition event="event1" target="s02"/> + <transition event="*" conf:targetfail=""/> + </state> + + <state id="s02"> + <transition event="event2" target="s03"/> + <transition event="*" conf:targetfail=""/> + </state> + <state id="s03"> + + <transition conf:idVal="1==0" event="event3" target="s0"/> + <transition conf:idVal="1==1" event="event1" target="s2"/> + <transition event="*" conf:targetfail=""/> + </state> +</state> + +<state id="s2"> + <transition event="event2" target="s3"/> + <transition event="*" conf:targetfail=""/> + + </state> + +<state id="s3"> + <transition event="event3" conf:targetfail=""/> + <transition event="timeout" conf:targetpass=""/> + </state> + + +<conf:pass/> +<conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/w3c/txml/test580.txml b/test/w3c/txml/test580.txml new file mode 100644 index 0000000..4fddd39 --- /dev/null +++ b/test/w3c/txml/test580.txml @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<!-- test that a history state never ends up part of the configuration --> + + +<scxml version="1.0" initial="p1" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + <datamodel> + <data conf:id="1" conf:expr="0"/> + </datamodel> + +<parallel id="p1"> + <onentry> + <send delay="2s" event="timeout"/> + </onentry> + + + <state id="s0"> + <transition conf:inState="sh1" conf:targetfail=""/> + <transition event="timeout" conf:targetfail=""/> + </state> + + +<state id="s1"> + <initial> + <transition target="sh1"/> + </initial> + + + <history id="sh1"> + <transition target="s11"/> + </history> + + <state id="s11"> + <transition conf:inState="sh1" conf:targetfail=""/> + <transition target="s12"/> + </state> + + <state id="s12"/> + <transition conf:inState="sh1" conf:targetfail=""/> + <transition conf:idVal="1==0" target="sh1"/> + <transition conf:idVal="1==1" conf:targetpass=""/> + <onexit> + <conf:incrementID id="1"/> + </onexit> + </state> + + + </parallel> + +<conf:pass/> +<conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/w3c/update-txml.sh b/test/w3c/update-txml.sh index 074318d..b733c6b 100755 --- a/test/w3c/update-txml.sh +++ b/test/w3c/update-txml.sh @@ -1,6 +1,11 @@ #!/bin/bash wget -rl1 -Atxml,txt,xsl http://www.w3.org/Voice/2013/scxml-irp/ +# wget http://www.w3.org/Voice/2013/scxml-irp/545/test545.txml +# wget http://www.w3.org/Voice/2013/scxml-irp/577/test577.txml +# mv test545.txml ./txml +# mv test577.txml ./txml + find ./www.w3.org -name "*.txml" -exec cp {} ./txml \; find ./www.w3.org -name "*.txt" -exec cp {} ./txml \; find ./www.w3.org -name "*.xsl" -exec cp {} . \; diff --git a/test/w3c/xpath/test159.scxml b/test/w3c/xpath/test159.scxml index 1f2af35..779ed7c 100644 --- a/test/w3c/xpath/test159.scxml +++ b/test/w3c/xpath/test159.scxml @@ -6,7 +6,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=""/> + <send event="thisWillFail" target="baz"/> <assign location="$Var1" expr="$Var1 + 1"/> </onentry> <transition cond="$Var1/text() =1" target="fail"/> diff --git a/test/w3c/xpath/test179.scxml b/test/w3c/xpath/test179.scxml index 1c281b5..42d1533 100644 --- a/test/w3c/xpath/test179.scxml +++ b/test/w3c/xpath/test179.scxml @@ -8,7 +8,7 @@ </send> </onentry> - <transition event="event1" cond="$_event/data = '123'" target="pass"/> + <transition event="event1" cond="$_event/data = 123" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/w3c/xpath/test193.scxml b/test/w3c/xpath/test193.scxml index 58a5c67..54926cf 100644 --- a/test/w3c/xpath/test193.scxml +++ b/test/w3c/xpath/test193.scxml @@ -1,17 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?><!-- we test that omitting target and targetexpr of <send> when using the -basichttp event i/o processor puts error.communication on the internal queue. --><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"> +SCXML event i/o processor puts the event on the external queue. --><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"> <state id="s0"> <onentry> - <!-- this should put an error in the internal queue --> - <send event="event1" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> - <send event="fail"/> + <send event="internal"/> + <!-- this should put event1 in the external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="timeout" delay="1s"/> </onentry> - <transition event="error.communication" target="pass"/> - <transition event="*" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="internal" target="s1"/> </state> + + <state id="s1"> + <transition event="event1" target="pass"/> + <transition event="timeout" 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> diff --git a/test/w3c/xpath/test233.scxml b/test/w3c/xpath/test233.scxml index c4d7eb7..e7b4116 100644 --- a/test/w3c/xpath/test233.scxml +++ b/test/w3c/xpath/test233.scxml @@ -26,7 +26,7 @@ the transtitions. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf </finalize> </invoke> - <transition event="childToParent" cond="" target="pass"/> + <transition event="childToParent" cond="$Var1/text() =2" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/w3c/xpath/test286.scxml b/test/w3c/xpath/test286.scxml index 80c0046..53aad73 100644 --- a/test/w3c/xpath/test286.scxml +++ b/test/w3c/xpath/test286.scxml @@ -4,7 +4,7 @@ where no error is raised --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns <state id="s0"> <onentry> - <assign location="$Var1" expr="1"/> + <assign location="foo.bar.baz " expr="1"/> <raise event="foo"/> </onentry> diff --git a/test/w3c/xpath/test298.scxml b/test/w3c/xpath/test298.scxml index ab8a5a9..8525192 100644 --- a/test/w3c/xpath/test298.scxml +++ b/test/w3c/xpath/test298.scxml @@ -1,9 +1,13 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- refence a non-existent data model location in param in donedata and see that the right error is raised --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="xpath" initial="s0"> +<?xml version="1.0" encoding="UTF-8"?><!-- reference a non-existent data model location in param in donedata and see that the right error is raised --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="xpath" initial="s0"> <datamodel> <data id="Var1" expr="0"/> </datamodel> <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="error.execution" target="pass"/> <transition event="*" target="fail"/> @@ -12,7 +16,7 @@ </state> <final id="s02"> <donedata> - <param name="Var3" location="$Var2"/> + <param name="Var3" location="foo.bar.baz "/> </donedata> </final> </state> diff --git a/test/w3c/xpath/test311.scxml b/test/w3c/xpath/test311.scxml index 487793c..1353b3e 100644 --- a/test/w3c/xpath/test311.scxml +++ b/test/w3c/xpath/test311.scxml @@ -3,7 +3,8 @@ <state id="s0"> <onentry> - <assign location="$Var1" expr="1"/> + <send event="timeout" delay="1s"/> + <assign location="foo.bar.baz " expr="1"/> </onentry> <transition event="error.execution" target="pass"/> <transition event=".*" target="fail"/> diff --git a/test/w3c/xpath/test330.scxml b/test/w3c/xpath/test330.scxml index 353c683..c95befd 100644 --- a/test/w3c/xpath/test330.scxml +++ b/test/w3c/xpath/test330.scxml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- check that the required fields are present in both internal and external events --><scxml xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="xpath" name="machineName"> +<?xml version="1.0" encoding="UTF-8"?><!-- check that the required fields are present in both internal and external events --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="xpath" name="machineName"> <state id="s0"> <onentry> @@ -17,7 +17,7 @@ </state> - <final xmlns="http://www.w3.org/2005/07/scxml" id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> - <final xmlns="http://www.w3.org/2005/07/scxml" id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + <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/w3c/xpath/test331.scxml b/test/w3c/xpath/test331.scxml index aec6d98..e887869 100644 --- a/test/w3c/xpath/test331.scxml +++ b/test/w3c/xpath/test331.scxml @@ -24,7 +24,7 @@ <state id="s2"> <onentry> <!-- this will generate an error, which is a platform event --> - <assign location="$Var2" expr="1"/> + <assign location="foo.bar.baz " expr="1"/> </onentry> <transition event="error" target="s3"> <assign location="$Var1" expr="$_event/type/text()"/> @@ -54,7 +54,7 @@ </state> - <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> - <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + <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/w3c/xpath/test350.scxml b/test/w3c/xpath/test350.scxml deleted file mode 100644 index ce94e9f..0000000 --- a/test/w3c/xpath/test350.scxml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- test that target value is used to decide what session to deliver the event to. A session should be -able to send an event to itself using its own session ID as the target --><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"> -<datamodel> - <data id="Var1" expr="'#_scxml_' + _sessionid"/> - </datamodel> - -<state id="s0"> - - <onentry> - <send delay="5s" event="timeout"/> - <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" targetexpr="$Var1" event="s0Event"/> - </onentry> - <transition event="s0Event" 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/w3c/xpath/test354.scxml b/test/w3c/xpath/test354.scxml index 93d768d..499b568 100644 --- a/test/w3c/xpath/test354.scxml +++ b/test/w3c/xpath/test354.scxml @@ -9,12 +9,12 @@ and that correct values are used --><scxml xmlns="http://www.w3.org/2005/07/scxm <state id="s0"> <onentry> <send delay="5s" event="timeout"/> - <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" namelist="Var1"> + <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="$Var2" expr="$_event/data/data[@id=Var'1']/data/text()"/> <assign location="$Var3" expr="$_event/data/data[@id='param1']/text()"/> </transition> <transition event="*" target="fail"> diff --git a/test/w3c/xpath/test401.scxml b/test/w3c/xpath/test401.scxml index 7900490..586a049 100644 --- a/test/w3c/xpath/test401.scxml +++ b/test/w3c/xpath/test401.scxml @@ -7,7 +7,7 @@ it was raised second --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:co <onentry> <send event="foo"/> <!-- assigning to a non-existent location should raise an error --> - <assign location="$Var1" expr="2"/> + <assign location="foo.bar.baz " expr="2"/> </onentry> diff --git a/test/w3c/xpath/test402.scxml b/test/w3c/xpath/test402.scxml index 4a822c8..798f992 100644 --- a/test/w3c/xpath/test402.scxml +++ b/test/w3c/xpath/test402.scxml @@ -14,7 +14,7 @@ are pulled off the internal queue in order, and that prefix matching works on th <!-- the first internal event. The error will be the second, and event2 will be the third --> <raise event="event1"/> <!-- assigning to a non-existent location should raise an error --> - <assign location="$Var1" expr="2"/> + <assign location="foo.bar.baz " expr="2"/> </onentry> <transition event="event1" target="s02"> diff --git a/test/w3c/xpath/test446.scxml b/test/w3c/xpath/test446.scxml new file mode 100644 index 0000000..0fa8698 --- /dev/null +++ b/test/w3c/xpath/test446.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that if the child of <data> is JSON, the processor + assigns it as the value of the var --><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">[1, 2, 3]</data> + <data id="var2" src="file:test458.txt"/> + </datamodel> + +<state id="s0"> + <transition cond="var1 instanceof Array" target="s1"/> + <transition target="fail"/> + </state> + +<state id="s1"> + <transition cond="var2 instanceof Array" 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/w3c/xpath/test459.scxml b/test/w3c/xpath/test459.scxml new file mode 100644 index 0000000..b631c25 --- /dev/null +++ b/test/w3c/xpath/test459.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that foreach goes over the array in the right order. since the array contains 1 2 3, we compare the current +value with the previous value, which is stored in var1. The current value should always be larger. If +it ever isn't, set Var4 to 0, indicating failure. Also check that the final value of the index +is 2 (meaning that the initial value was 0, not 1) --><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="0"/> <!-- contains the previous value --> + <data id="Var2"/> <!-- the item which will contain the current value --> + <data id="Var3"/> <!-- the index --> + <data id="Var4" expr="[1,2,3]"/> + <data id="Var5" expr="1"/> <!-- 1 if success, 0 if failure --> + </datamodel> + + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var4" index="Var3"> + <if cond="Var1<Var2"> + <assign location="Var1" expr="Var2"/> + <else/> + <!-- values are out of order, record failure --> + <assign location="Var5" expr="0"/> + </if> + </foreach> + </onentry> + + <!-- check that var1 has its original value --> + <transition cond="Var4==0 | Var3 != 2" target="fail"/> + <transition target="pass"/> + </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/w3c/xpath/test496.scxml b/test/w3c/xpath/test496.scxml new file mode 100644 index 0000000..a30064f --- /dev/null +++ b/test/w3c/xpath/test496.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?><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"> + + +<state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="event" target="#_scxml_foo"/> + <raise event="foo"/> + </onentry> + <transition event="error.communication" 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/w3c/xpath/test528.scxml b/test/w3c/xpath/test528.scxml index f8f8416..eda36d2 100644 --- a/test/w3c/xpath/test528.scxml +++ b/test/w3c/xpath/test528.scxml @@ -6,7 +6,6 @@ <transition event="error.execution" target="s1"/> <transition event="done.state.s0" target="fail"/> - <transition event="done.state.s0" target="fail"/> <state id="s01"> <transition target="s02"/> diff --git a/test/w3c/xpath/test529.scxml b/test/w3c/xpath/test529.scxml index 5a78529..d67af4b 100644 --- a/test/w3c/xpath/test529.scxml +++ b/test/w3c/xpath/test529.scxml @@ -3,7 +3,7 @@ <state id="s0" initial="s01"> - <transition event="done.state.s0" cond="$_event/data = '21'" target="pass"> + <transition event="done.state.s0" cond="$_event/data = 21" target="pass"> </transition> <transition event="done.state.s0" target="fail"> diff --git a/test/w3c/xpath/test545.scxml b/test/w3c/xpath/test545.scxml new file mode 100644 index 0000000..1e12770 --- /dev/null +++ b/test/w3c/xpath/test545.scxml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that xml content in send is place as XML under event/data --><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"> + +<state id="s0"> + <onentry> + <send event="someevent"> + <content><foo xmlns=""><bar>3</bar></foo></content> + </send> + </onentry> + + <transition event="*" cond="$_event/data/foo/bar = 3" 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/w3c/xpath/test561.scxml b/test/w3c/xpath/test561.scxml index e50e00c..e94a813 100644 --- a/test/w3c/xpath/test561.scxml +++ b/test/w3c/xpath/test561.scxml @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that processor creates an ECMAScript object - _event.data when receiving JSON in an event --><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"> +<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that processor creates an ECMAScript DOM object + _event.data when receiving XML in an event --><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"> <state id="s0"> diff --git a/test/w3c/xpath/test577.scxml b/test/w3c/xpath/test577.scxml new file mode 100644 index 0000000..7652834 --- /dev/null +++ b/test/w3c/xpath/test577.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that <send> without target in basichttp event i/o processor +causes error.communication to get added to internal queue . --><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"> + <onentry> + <!-- sent by scxml event i/o processor, added to external queue --> + <send event="event1"/> + <!-- should put error.communication on internal queue --> + <send event="test" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + + </onentry> + + + <transition event="error.communication" 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/w3c/xpath/test578.scxml b/test/w3c/xpath/test578.scxml index bdb5e2d..9a25195 100644 --- a/test/w3c/xpath/test578.scxml +++ b/test/w3c/xpath/test578.scxml @@ -5,7 +5,7 @@ <state id="s0"> <onentry> <send event="foo"> - <content>{ productName : "bar", size : 27 }</content> + <content>{ "productName" : "bar", "size" : 27 }</content> </send> </onentry> <transition event="foo" cond="_event.data.productName == 'bar'" target="pass"/> diff --git a/test/w3c/xpath/test579.scxml b/test/w3c/xpath/test579.scxml new file mode 100644 index 0000000..311c0a9 --- /dev/null +++ b/test/w3c/xpath/test579.scxml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that default history content is executed correctly. The Process MUST execute any executable content in the transition after the parent state's onentry handlers, and, in the case where the history pseudo-state is the target of an <initial> transition, +the executable content inside the <initial> transition. However the Processor MUST +execute this content only if there is no stored history. Once the history state's +parent state has been visited and exited, the default history content must not be executed --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="xpath"> + + +<state id="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <initial> + <transition target="sh1"> + <raise event="event2"/> + </transition> + </initial> + <onentry> + <send delay="2s" event="timeout"/> + <raise event="event1"/> + </onentry> + <onexit> + <assign location="$Var1" expr="$Var1 + 1"/> + </onexit> + <history id="sh1"> + <transition target="s01"> + <raise event="event3"/> + </transition> + </history> + + <state id="s01"> + <transition event="event1" target="s02"/> + <transition event="*" target="fail"/> + </state> + + <state id="s02"> + <transition event="event2" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + + <transition cond="$Var1/text() ==0" event="event3" target="s0"/> + <transition cond="$Var1/text() ==1" event="event1" target="s2"/> + <transition event="*" target="fail"/> + </state> +</state> + +<state id="s2"> + <transition event="event2" target="s3"/> + <transition event="*" target="fail"/> + + </state> + +<state id="s3"> + <transition event="event3" target="fail"/> + <transition event="timeout" target="pass"/> + </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/w3c/xpath/test580.scxml b/test/w3c/xpath/test580.scxml new file mode 100644 index 0000000..272bbce --- /dev/null +++ b/test/w3c/xpath/test580.scxml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that a history state never ends up part of the configuration --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="p1" datamodel="xpath"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + +<parallel id="p1"> + <onentry> + <send delay="2s" event="timeout"/> + </onentry> + + + <state id="s0"> + <transition cond="In('sh1')" target="fail"/> + <transition event="timeout" target="fail"/> + </state> + + +<state id="s1"> + <initial> + <transition target="sh1"/> + </initial> + + + <history id="sh1"> + <transition target="s11"/> + </history> + + <state id="s11"> + <transition cond="In('sh1')" target="fail"/> + <transition target="s12"/> + </state> + + <state id="s12"/> + <transition cond="In('sh1')" target="fail"/> + <transition cond="$Var1/text() ==0" target="sh1"/> + <transition cond="$Var1/text() ==1" target="pass"/> + <onexit> + <assign location="$Var1" expr="$Var1 + 1"/> + </onexit> + </state> + + + </parallel> + +<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 |