diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-10-12 11:11:06 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-10-12 11:11:06 (GMT) |
commit | fa90b5749693d9f5817ad1f106334a0877171fd3 (patch) | |
tree | 8d53b5c820590cad54893bc575ef55df38f55d23 /test | |
parent | c36b123a60278caef5d06e8a7d0b3d338d669c75 (diff) | |
download | uscxml-fa90b5749693d9f5817ad1f106334a0877171fd3.zip uscxml-fa90b5749693d9f5817ad1f106334a0877171fd3.tar.gz uscxml-fa90b5749693d9f5817ad1f106334a0877171fd3.tar.bz2 |
Major work on PROMELA datamodel
Diffstat (limited to 'test')
214 files changed, 7989 insertions, 455 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7a0ad3a..035f22e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -68,6 +68,8 @@ add_test(test-execution ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/uscxml-browser ${CMAKE add_test(test-communication ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/uscxml-browser -t5493 ${CMAKE_SOURCE_DIR}/test/uscxml/test-communication.scxml) add_test(test-done-data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/uscxml-browser ${CMAKE_SOURCE_DIR}/test/uscxml/test-donedata.scxml) +find_program(SPIN spin) +find_program(GCC gcc) if (NOT BUILD_MINIMAL) add_executable(test-w3c src/test-w3c.cpp) @@ -117,6 +119,30 @@ if (NOT BUILD_MINIMAL) # set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST FAILED") endif() + if (BUILD_DM_PROMELA AND BUILD_TESTS_W3C_PROMELA AND TEST_NAME MATCHES "^promela\\/.*") + add_test(${TEST_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-w3c ${W3C_TEST}) + set_property(TEST ${TEST_NAME} PROPERTY LABELS ${TEST_NAME}) + # set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST FAILED") + endif() + + if (GCC AND SPIN AND BUILD_DM_PROMELA AND BUILD_TESTS_W3C_PROMELA AND TEST_NAME MATCHES "^promela\\/.*") + + add_test(NAME "spin/${TEST_NAME}" + COMMAND ${CMAKE_COMMAND} + -DOUTDIR:FILEPATH=${CMAKE_CURRENT_BINARY_DIR} + -DTESTFILE:FILEPATH=${W3C_TEST} + -DUSCXML_TRANSFORM_BIN:FILEPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/uscxml-transform + -DSPIN_BIN:FILEPATH=${SPIN} + -DGCC_BIN:FILEPATH=${GCC} + -P ${CMAKE_CURRENT_SOURCE_DIR}/w3c/run_promela_test.cmake) + set_property(TEST "spin/${TEST_NAME}" PROPERTY LABELS "spin/${TEST_NAME}") + set_tests_properties("spin/${TEST_NAME}" PROPERTIES PASS_REGULAR_EXPRESSION "depth reached [0-9]+, errors: 0") + set_tests_properties("spin/${TEST_NAME}" PROPERTIES FAIL_REGULAR_EXPRESSION "depth reached [0-9]+, errors: [1-9]+") + + set_tests_properties(${TEST_NAME} PROPERTIES DEPENDS uscxml-transform) + # set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST FAILED") + endif() + endif() endforeach() endif()
\ No newline at end of file diff --git a/test/ctest/CTestCustom.ctest.in b/test/ctest/CTestCustom.ctest.in index 6b5fd3c..e26bbf2 100644 --- a/test/ctest/CTestCustom.ctest.in +++ b/test/ctest/CTestCustom.ctest.in @@ -17,24 +17,145 @@ set(CTEST_CUSTOM_TESTS_IGNORE "ecma/test415.scxml" # Manual - PASSED "fsm/ecma/test178.scxml" # manual test - "fsm/ecma/test224.scxml" # automatically generated id has the form stateid.platformid + # "fsm/ecma/test224.scxml" # automatically generated id has the form stateid.platformid "fsm/ecma/test230.scxml" # manual test "fsm/ecma/test250.scxml" # manual test + "fsm/ecma/test301.scxml" # manual test "fsm/ecma/test307.scxml" # manual test - "fsm/ecma/test324.scxml" # _name can be assigned - "fsm/ecma/test329.scxml" # system variables can be modified - "fsm/ecma/test346.scxml" # change the value of a system variable - "fsm/ecma/test409.scxml" # In predicate - "fsm/ecma/test411.scxml" # In predicate "fsm/ecma/test415.scxml" # manual test - "fsm/ecma/test436.scxml" # In predicate - "fsm/ecma/test519.scxml" # unspecified basichttp format - "fsm/ecma/test520.scxml" # unspecified basichttp format - "fsm/ecma/test531.scxml" # unspecified basichttp format - "fsm/ecma/test534.scxml" # unspecified basichttp format - "fsm/ecma/test567.scxml" # unspecified basichttp format "xpath/test580.scxml" # hangs + + "promela/test178.scxml" # manual test + "promela/test190.scxml" # string concatenation + "promela/test224.scxml" # string operation startWith + "promela/test230.scxml" # manual test + "promela/test250.scxml" # manual test + "promela/test277.scxml" # no runtime checks for undeclared variables + "promela/test280.scxml" # no runtime checks for undeclared variables + "promela/test301.scxml" # manual test + "promela/test307.scxml" # manual test +# "promela/test330.scxml" # no "defined" operator in promela +# "promela/test333.scxml" # no typeof or "defined" operator in promela +# "promela/test335.scxml" # no typeof or "defined" operator in promela +# "promela/test337.scxml" # no typeof or "defined" operator in promela + "promela/test350.scxml" # string concatenation + "promela/test415.scxml" # manual test + "promela/test436.scxml" # In(s) -> _x.states[s] prevents completion as NULL dm is hardcoded + "promela/test509.scxml" # string operation contains + "promela/test518.scxml" # string operation contains + "promela/test519.scxml" # string operation contains + "promela/test520.scxml" # string operation contains + "promela/test525.scxml" # assumes unbound arrays + "promela/test530.scxml" # assigns DOM node to variable + "promela/test534.scxml" # string operation contains + + # fail for syntax + "spin/promela/test150.scxml" # test that foreach causes a new variable to be declared + "spin/promela/test151.scxml" # test that foreach causes a new variable to be declared + "spin/promela/test152.scxml" # test that an illegal array or item value causes error.execution + "spin/promela/test156.scxml" # test that an error causes the foreach to stop execution + "spin/promela/test172.scxml" # targetexpr _internal - can we support? + "spin/promela/test224.scxml" # string operation startWith + "spin/promela/test224.scxml" # string operation startWith + "spin/promela/test277.scxml" # 'return' as a literal + "spin/promela/test280.scxml" # late data binding + "spin/promela/test286.scxml" # assigment to a non-declared var + "spin/promela/test294.scxml" # mixed types for event.data + "spin/promela/test301.scxml" # manual test + "spin/promela/test302.scxml" # variable not declared + "spin/promela/test304.scxml" # variable not declared + "spin/promela/test307.scxml" # manual test + "spin/promela/test309.scxml" # 'return' as an invalid boolean expression ought to eval to false + "spin/promela/test311.scxml" # assigment to a non-declared var + "spin/promela/test312.scxml" # assignment of 'return' + "spin/promela/test313.scxml" # assignment of 'return' + "spin/promela/test314.scxml" # assignment of 'return' + "spin/promela/test322.scxml" # assignment to _sessionid + "spin/promela/test324.scxml" # assignment to _name + "spin/promela/test325.scxml" # assignment from _ioprocessor + "spin/promela/test326.scxml" # assignment from _ioprocessor + "spin/promela/test329.scxml" # several assignment to constants + "spin/promela/test331.scxml" # assigment to a non-declared var + "spin/promela/test344.scxml" # 'return' as a cond + "spin/promela/test346.scxml" # assignment to system variables + "spin/promela/test350.scxml" # string concatenation + "spin/promela/test354.scxml" # mixed types for event.data + "spin/promela/test401.scxml" # variable not declared + "spin/promela/test402.scxml" # variable not declared + "spin/promela/test415.scxml" # manual test + "spin/promela/test436.scxml" # In(s) -> _x.states[s] prevents completion as NULL dm is hardcoded + "spin/promela/test487.scxml" # assignment of 'return' + "spin/promela/test509.scxml" # string operation contains + "spin/promela/test518.scxml" # string operation contains + "spin/promela/test519.scxml" # string operation contains + "spin/promela/test520.scxml" # string operation contains + "spin/promela/test525.scxml" # assumes unbound arrays + "spin/promela/test530.scxml" # assigns DOM node to variable + "spin/promela/test534.scxml" # string operation contains + + # fail for semantics + "spin/promela/test159.scxml" # error raised causes all subsequent elements to be skipped + "spin/promela/test175.scxml" # delay used + "spin/promela/test178.scxml" # manual test with two identical params - failed + "spin/promela/test185.scxml" # delay used + "spin/promela/test191.scxml" # nested SCXML document + "spin/promela/test192.scxml" # delay used and nested SCXML document + "spin/promela/test194.scxml" # illegal target for send + "spin/promela/test199.scxml" # invalid send type + "spin/promela/test207.scxml" # delay / cancel + "spin/promela/test208.scxml" # delay / cancel + "spin/promela/test210.scxml" # sendidexpr works with cancel + "spin/promela/test215.scxml" # nested SCXML document + "spin/promela/test216.scxml" # assignment from file and nested SCXML document + "spin/promela/test220.scxml" # nested SCXML document + "spin/promela/test223.scxml" # nested SCXML document + "spin/promela/test225.scxml" # nested SCXML document - can't we just copy as nested states with event prefixes? + "spin/promela/test226.scxml" # assignment from file and nested SCXML document + "spin/promela/test228.scxml" # nested SCXML document and invokeid + "spin/promela/test229.scxml" # nested SCXML document with autoforward + "spin/promela/test230.scxml" # nested SCXML document with manual test + "spin/promela/test232.scxml" # nested SCXML document sends events + "spin/promela/test233.scxml" # nested SCXML document with finalize + "spin/promela/test234.scxml" # nested SCXML document with finalize + "spin/promela/test235.scxml" # nested SCXML document sends done.invoke + "spin/promela/test236.scxml" # nested SCXML document sends done.invoke as last event + "spin/promela/test239.scxml" # nested SCXML document from content and src + "spin/promela/test240.scxml" # nested SCXML document with namelist + "spin/promela/test241.scxml" # nested SCXML document with namelist and param + "spin/promela/test243.scxml" # nested SCXML document with param + "spin/promela/test244.scxml" # nested SCXML document with namelist + "spin/promela/test245.scxml" # nested SCXML document with unbound vars + "spin/promela/test247.scxml" # nested SCXML document with done.invoke + "spin/promela/test253.scxml" # nested SCXML document with bidirectional SCXML ioprocessor + "spin/promela/test276.scxml" # nested SCXML document overriding var defaults + "spin/promela/test298.scxml" # non-existent data model location + "spin/promela/test332.scxml" # sendid is present in error events + "spin/promela/test338.scxml" # test that invokeid is set correctly + "spin/promela/test343.scxml" # test that illegal <param> produces error.execution + "spin/promela/test347.scxml" # nested SCXML document with bidirectional SCXML ioprocessor + "spin/promela/test351.scxml" # timeout with delay + "spin/promela/test342.scxml" # timeout with delay + "spin/promela/test388.scxml" # timeout with delay + "spin/promela/test399.scxml" # timeout with delay + # "spin/promela/test409.scxml" # entering states order - In + # "spin/promela/test411.scxml" # entering states order - In + "spin/promela/test422.scxml" # nested SCXML document + "spin/promela/test488.scxml" # illegal expr in <param> produces error.execution + "spin/promela/test496.scxml" # tests error.communication with illegal target + "spin/promela/test500.scxml" # uses _ioprocessors.scxml.location + "spin/promela/test510.scxml" # uses _ioprocessors.basichttp.location + "spin/promela/test521.scxml" # tests error.communication with illegal target + "spin/promela/test522.scxml" # uses _ioprocessors.basichttp.location + "spin/promela/test528.scxml" # illegal 'expr' produces error.execution + "spin/promela/test531.scxml" # uses _ioprocessors.basichttp.location + "spin/promela/test532.scxml" # uses _ioprocessors.basichttp.location + "spin/promela/test552.scxml" # initialize data from file + "spin/promela/test567.scxml" # uses _ioprocessors.basichttp.location + "spin/promela/test577.scxml" # send without target for basichttp + "spin/promela/test580.scxml" # timeout with delay + + ) diff --git a/test/src/test-flat-stateid.cpp b/test/src/test-flat-stateid.cpp index 719e4ee..7820d61 100644 --- a/test/src/test-flat-stateid.cpp +++ b/test/src/test-flat-stateid.cpp @@ -10,7 +10,7 @@ int main(int argc, char** argv) { assert(flat1.getActive().size() == 0); assert(flat1.getVisited().size() == 0); assert(flat1.getHistory().size() == 0); - + uscxml::FlatStateIdentifier flat2(flat1.getActive(), flat1.getVisited(), flat1.getHistory()); assert(flat2.getStateId() == stateId); } @@ -21,26 +21,26 @@ int main(int argc, char** argv) { assert(flat1.getActive().size() == 1); assert(flat1.getVisited().size() == 2); assert(flat1.getHistory().size() == 0); - + uscxml::FlatStateIdentifier flat2(flat1.getActive(), flat1.getVisited(), flat1.getHistory()); assert(flat2.getStateId() == stateId); } { - + std::string stateId = "active:{s0,s1,s2};visited:{s0,s1,s2};history:{h0:{s1,s2},h1:{s2,s3}}"; uscxml::FlatStateIdentifier flat1(stateId); - + listIter = flat1.getActive().begin(); assert(*listIter++ == "s0"); assert(*listIter++ == "s1"); assert(*listIter++ == "s2"); - + listIter = flat1.getVisited().begin(); assert(*listIter++ == "s0"); assert(*listIter++ == "s1"); assert(*listIter++ == "s2"); - + assert(flat1.getHistory().find("h0") != flat1.getHistory().end()); listIter = flat1.getHistory().at("h0").begin(); assert(*listIter++ == "s1"); diff --git a/test/src/test-issue-reporting.cpp b/test/src/test-issue-reporting.cpp index cd1687c..39dad05 100644 --- a/test/src/test-issue-reporting.cpp +++ b/test/src/test-issue-reporting.cpp @@ -7,9 +7,9 @@ using namespace uscxml; std::set<std::string> issueLocationsForXML(const std::string xml) { Interpreter interpreter = Interpreter::fromXML(xml); std::list<InterpreterIssue> issues = interpreter.validate(); - + std::set<std::string> issueLocations; - + for (std::list<InterpreterIssue>::iterator issueIter = issues.begin(); issueIter != issues.end(); issueIter++) { std::cout << *issueIter << std::endl; issueLocations.insert(issueIter->xPath); @@ -20,7 +20,9 @@ std::set<std::string> issueLocationsForXML(const std::string xml) { size_t runtimeIssues; class IssueMonitor : public InterpreterMonitor { public: - IssueMonitor() { runtimeIssues = 0; } + IssueMonitor() { + runtimeIssues = 0; + } void reportIssue(Interpreter interpreter, const InterpreterIssue& issue) { runtimeIssues++; } @@ -37,42 +39,42 @@ int main(int argc, char** argv) { if (1) { // Potential endless loop - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <datamodel><data id=\"counter\" expr=\"5\" /></datamodel>" - " <state id=\"foo\">" - " <onentry><script>counter--;</script></onentry>" - " <transition target=\"foo\" cond=\"counter > 0\" />" - " <transition target=\"bar\" cond=\"counter == 0\" />" - " </state>" - " <state id=\"bar\" final=\"true\" />" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <datamodel><data id=\"counter\" expr=\"5\" /></datamodel>" + " <state id=\"foo\">" + " <onentry><script>counter--;</script></onentry>" + " <transition target=\"foo\" cond=\"counter > 0\" />" + " <transition target=\"bar\" cond=\"counter == 0\" />" + " </state>" + " <state id=\"bar\" final=\"true\" />" + "</scxml>"; + IssueMonitor monitor; Interpreter interpreter = Interpreter::fromXML(xml); interpreter.addMonitor(&monitor); interpreter.interpret(); - + // first reiteration is not counted as it might be valid when raising internal errors assert(runtimeIssues == 3); } if (1) { // Unreachable states - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"foo\">" - " <parallel id=\"foz\">" - " <state id=\"s0\" />" - " <state id=\"s1\" />" - " <state id=\"s2\" />" - " </parallel>" - " </state>" - " <state id=\"bar\" />" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"foo\">" + " <parallel id=\"foz\">" + " <state id=\"s0\" />" + " <state id=\"s1\" />" + " <state id=\"s2\" />" + " </parallel>" + " </state>" + " <state id=\"bar\" />" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"bar\"]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -80,14 +82,14 @@ int main(int argc, char** argv) { if (1) { // Invalid parents - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <onentry>" - " <cancel sendidexpr=\"foo\" />" - " </onentry>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <onentry>" + " <cancel sendidexpr=\"foo\" />" + " </onentry>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("/scxml[1]/onentry[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -96,11 +98,11 @@ int main(int argc, char** argv) { if (1) { // State has no 'id' attribute const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state>" - " <transition/>" - " </state>" - "</scxml>"; + "<scxml datamodel=\"ecmascript\">" + " <state>" + " <transition/>" + " </state>" + "</scxml>"; std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("/scxml[1]/state[1]") != issueLocations.end()); @@ -110,11 +112,11 @@ int main(int argc, char** argv) { if (1) { // Duplicate state with id const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\" />" - " <state id=\"start\" />" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\" />" + " <state id=\"start\" />" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -122,32 +124,32 @@ int main(int argc, char** argv) { if (1) { // Transition has non-existant target state - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <transition target=\"done\" />" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <transition target=\"done\" />" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/transition[1]") != issueLocations.end()); assert(issueLocations.size() == 1); } - + if (1) { // Transition can never be optimally enabled (conditionless, eventless) - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <transition target=\"done\" />" - " <transition target=\"done\" />" - " </state>" - " <final id=\"done\" />" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <transition target=\"done\" />" + " <transition target=\"done\" />" + " </state>" + " <final id=\"done\" />" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/transition[2]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -155,29 +157,29 @@ int main(int argc, char** argv) { if (1) { // Transition can never be optimally enabled (conditionless, more events) - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <transition event=\"error\" target=\"done\" />" - " <transition event=\"error.bar error.foo\" />" - " </state>" - " <final id=\"done\" />" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <transition event=\"error\" target=\"done\" />" + " <transition event=\"error.bar error.foo\" />" + " </state>" + " <final id=\"done\" />" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/transition[2]") != issueLocations.end()); assert(issueLocations.size() == 1); } - + if (1) { // Initial attribute has invalid target state - + const char* xml = - "<scxml datamodel=\"ecmascript\" initial=\"foo\">" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\" initial=\"foo\">" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("/scxml[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -185,14 +187,14 @@ int main(int argc, char** argv) { if (1) { // Invoke with unknown type - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <invoke type=\"non-existant\" />" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <invoke type=\"non-existant\" />" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/invoke[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -200,16 +202,16 @@ int main(int argc, char** argv) { if (1) { // Send to unknown IO Processor - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <onentry>" - " <send type=\"non-existant\" />" - " </onentry>" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <onentry>" + " <send type=\"non-existant\" />" + " </onentry>" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/send[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -217,11 +219,11 @@ int main(int argc, char** argv) { if (1) { // SCXML document requires unknown datamodel - + const char* xml = - "<scxml datamodel=\"non-existant\">" - "</scxml>"; - + "<scxml datamodel=\"non-existant\">" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("/scxml[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -229,16 +231,16 @@ int main(int argc, char** argv) { if (1) { // Unknown executable content element - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <onentry>" - " <nonexistant />" - " </onentry>" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <onentry>" + " <nonexistant />" + " </onentry>" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/nonexistant[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -246,14 +248,14 @@ int main(int argc, char** argv) { if (1) { // Syntax error in script - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <script>" - " $wfwegr^ " - " </script>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <script>" + " $wfwegr^ " + " </script>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("/scxml[1]/script[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -261,19 +263,19 @@ int main(int argc, char** argv) { if (1) { // Syntax error in cond attribute - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <onentry>" - " <if cond=\"%2345\">" - " <elseif cond=\"%2345\" />" - " </if>" - " </onentry>" - " <transition cond=\"%2345\" />" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <onentry>" + " <if cond=\"%2345\">" + " <elseif cond=\"%2345\" />" + " </if>" + " </onentry>" + " <transition cond=\"%2345\" />" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/transition[1]") != issueLocations.end()); assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/if[1]") != issueLocations.end()); @@ -283,24 +285,24 @@ int main(int argc, char** argv) { if (1) { // Syntax error in expr attribute - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <datamodel>" - " <data id=\"foo\" expr=\"%2345\" />" - " </datamodel>" - " <state id=\"start\">" - " <onentry>" - " <log expr=\"%2345\" />" - " <assign location=\"foo\" expr=\"%2345\" />" - " <send>" - " <param expr=\"%2345\" />" - " <content expr=\"%2345\" />" - " </send>" - " </onentry>" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <datamodel>" + " <data id=\"foo\" expr=\"%2345\" />" + " </datamodel>" + " <state id=\"start\">" + " <onentry>" + " <log expr=\"%2345\" />" + " <assign location=\"foo\" expr=\"%2345\" />" + " <send>" + " <param expr=\"%2345\" />" + " <content expr=\"%2345\" />" + " </send>" + " </onentry>" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/log[1]") != issueLocations.end()); assert(issueLocations.find("//data[@id=\"foo\"]") != issueLocations.end()); @@ -312,17 +314,17 @@ int main(int argc, char** argv) { if (1) { // Syntax error with foreach - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <onentry>" - " <foreach item=\"%2345\" index=\"%2345\" array=\"%2345\">" - " </foreach>" - " </onentry>" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <onentry>" + " <foreach item=\"%2345\" index=\"%2345\" array=\"%2345\">" + " </foreach>" + " </onentry>" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/foreach[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -330,16 +332,16 @@ int main(int argc, char** argv) { if (1) { // Syntax error with send - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <onentry>" - " <send eventexpr=\"%2345\" targetexpr=\"%2345\" typeexpr=\"%2345\" idlocation=\"%2345\" delayexpr=\"%2345\" />" - " </onentry>" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <onentry>" + " <send eventexpr=\"%2345\" targetexpr=\"%2345\" typeexpr=\"%2345\" idlocation=\"%2345\" delayexpr=\"%2345\" />" + " </onentry>" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/send[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -347,14 +349,14 @@ int main(int argc, char** argv) { if (1) { // Syntax error with invoke - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <invoke typeexpr=\"%2345\" srcexpr=\"%2345\" idlocation=\"%2345\" />" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <invoke typeexpr=\"%2345\" srcexpr=\"%2345\" idlocation=\"%2345\" />" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/invoke[1]") != issueLocations.end()); assert(issueLocations.size() == 1); @@ -362,16 +364,16 @@ int main(int argc, char** argv) { if (1) { // Syntax error with cancel - + const char* xml = - "<scxml datamodel=\"ecmascript\">" - " <state id=\"start\">" - " <onentry>" - " <cancel sendidexpr=\"%2345\" />" - " </onentry>" - " </state>" - "</scxml>"; - + "<scxml datamodel=\"ecmascript\">" + " <state id=\"start\">" + " <onentry>" + " <cancel sendidexpr=\"%2345\" />" + " </onentry>" + " </state>" + "</scxml>"; + std::set<std::string> issueLocations = issueLocationsForXML(xml); assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/cancel[1]") != issueLocations.end()); assert(issueLocations.size() == 1); diff --git a/test/src/test-mmi.cpp b/test/src/test-mmi.cpp index eeb71ee..52deeef 100644 --- a/test/src/test-mmi.cpp +++ b/test/src/test-mmi.cpp @@ -30,14 +30,14 @@ int main(int argc, char** argv) { // --- NewContextRequest std::stringstream ss; ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"><mmi:NewContextRequest mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:RequestID=\"request-1\"></mmi:NewContextRequest></mmi:mmi>"; - + NewContextRequest msg = NewContextRequest::fromXML(xmlToDoc(ss.str())); assert(boost::iequals(msg.tagName, "NewContextRequest")); assert(boost::iequals(msg.source, "someURI")); assert(boost::iequals(msg.target, "someOtherURI")); assert(boost::iequals(msg.requestId, "request-1")); assert(boost::iequals(msg.data, "")); - + NewContextRequest msg2 = NewContextRequest::fromXML(msg.toXML()); assert(boost::iequals(msg2.tagName, "NewContextRequest")); assert(boost::iequals(msg2.source, "someURI")); @@ -50,7 +50,7 @@ int main(int argc, char** argv) { xml1SS << msg.toXML(); xml2SS << msg2.toXML(); assert(xml1SS.str() == xml2SS.str()); - + Event ev = msg; assert(ev.name == "mmi.request.newcontext"); assert(ev.origin == msg.source); @@ -143,7 +143,7 @@ int main(int argc, char** argv) { assert(boost::iequals(msg.requestId, "request-1")); assert(boost::iequals(msg.context, "URI-1")); assert(msg.contentDOM); - + PrepareRequest msg2 = PrepareRequest::fromXML(msg.toXML()); assert(boost::iequals(msg2.tagName, "PrepareRequest")); assert(boost::iequals(msg2.source, "someURI")); @@ -270,29 +270,29 @@ int main(int argc, char** argv) { assert(boost::iequals(msg.target, "someOtherURI")); assert(boost::iequals(msg.requestId, "request-1")); assert(boost::iequals(msg.context, "URI-1")); - + StartRequest msg2 = StartRequest::fromXML(msg.toXML()); assert(boost::iequals(msg2.tagName, "StartRequest")); assert(boost::iequals(msg2.source, "someURI")); assert(boost::iequals(msg2.target, "someOtherURI")); assert(boost::iequals(msg2.requestId, "request-1")); assert(boost::iequals(msg2.context, "URI-1")); - + std::stringstream xml1SS; std::stringstream xml2SS; xml1SS << msg.toXML(); xml2SS << msg2.toXML(); assert(xml1SS.str() == xml2SS.str()); - + Event ev = msg; assert(ev.name == "mmi.request.start"); assert(ev.data.compound["foo"] == 12); assert(ev.origin == msg.source); - + } - - + + { // --- StartResponse std::stringstream ss; @@ -516,7 +516,7 @@ int main(int argc, char** argv) { Event ev = msg; assert(ev.name == "mmi.response.pause"); assert(ev.origin == msg.source); - + } { @@ -624,7 +624,7 @@ int main(int argc, char** argv) { assert(boost::iequals(msg.requestId, "request-1")); assert(boost::iequals(msg.context, "someURI")); assert(boost::iequals(msg.name, "appEvent")); - + ExtensionNotification msg2 = ExtensionNotification::fromXML(msg.toXML()); assert(boost::iequals(msg2.tagName, "ExtensionNotification")); assert(boost::iequals(msg2.source, "someURI")); @@ -632,18 +632,18 @@ int main(int argc, char** argv) { assert(boost::iequals(msg2.requestId, "request-1")); assert(boost::iequals(msg2.context, "someURI")); assert(boost::iequals(msg2.name, "appEvent")); - + std::stringstream xml1SS; std::stringstream xml2SS; xml1SS << msg.toXML(); xml2SS << msg2.toXML(); assert(xml1SS.str() == xml2SS.str()); - + Event ev = msg; assert(ev.name == "appEvent"); assert(ev.data.compound["foo"] == 12); assert(ev.origin == msg.source); - + } { diff --git a/test/src/test-promela-parser.cpp b/test/src/test-promela-parser.cpp index 61e6b3f..261b8c9 100644 --- a/test/src/test-promela-parser.cpp +++ b/test/src/test-promela-parser.cpp @@ -165,8 +165,6 @@ void testInlinePromela() { assert(prmInls.inlines.front().sequences.size() == 0); assert(boost::trim_copy(prmInls.inlines.front().content) == "This is foo!"); } - - exit(0); } void testPromelaParser() { @@ -188,6 +186,18 @@ void testPromelaParser() { expressions.push_back("bool busy[3];"); expressions.push_back("bool busy[3], us[4];"); expressions.push_back("mtype = {\nred, white, blue,\nabort, accept, ack, sync_ack, close, connect,\ncreate, data, eof, open, reject, sync, transfer,\nFATAL, NON_FATAL, COMPLETE\n}"); + expressions.push_back("typedef D { short f; byte g }; "); + expressions.push_back("x = 1"); + expressions.push_back("x = foo.bar[2].baz; "); + expressions.push_back("_event.data[1].aParam.key1.key2[1].key3.key4"); + expressions.push_back("_event.data.aParam"); + expressions.push_back("_event.data"); + expressions.push_back("_event"); + expressions.push_back("states"); + expressions.push_back("states[1]"); + expressions.push_back("_x.states[1]"); + expressions.push_back("_x.states[1].foo"); + expressions.push_back("_event.data[1].aParam.key1.key2[1].key3.key4"); /* expressions */ expressions.push_back("i+1"); @@ -203,8 +213,8 @@ void testPromelaParser() { expressions.push_back("c++"); expressions.push_back("state = state - 1"); expressions.push_back("printf(\"hello world\\n\")"); - expressions.push_back("printf(\"result %d: %d\n\", id, res, foo, bar)"); - expressions.push_back("printf(\"x = %d\n\", x)"); + expressions.push_back("printf(\"result %d: %d\\n\", id, res, foo, bar)"); + expressions.push_back("printf(\"x = %d\\n\", x)"); expressions.push_back("(n <= 1)"); expressions.push_back("res = (a*a+b)/2*a;"); expressions.push_back("assert(0) /* a forced stop, (Chapter 6) */"); diff --git a/test/src/test-sockets.cpp b/test/src/test-sockets.cpp index 993aaff..16234ee 100644 --- a/test/src/test-sockets.cpp +++ b/test/src/test-sockets.cpp @@ -74,10 +74,10 @@ int main(int argc, char** argv) { // LogServer server(PF_INET, SOCK_STREAM, 0); server.listen("*", 1235); server.setBlockSizeRead(1); - + TestClient client(PF_INET, SOCK_STREAM, 0); client.connect("127.0.0.1", 1235); - + int iterations = 1000; std::stringstream contentSS; for (int i = 0; i < iterations; i++) { @@ -94,7 +94,7 @@ int main(int argc, char** argv) { packetSeq = 0; CountingPacketServer server(PF_INET, SOCK_STREAM, 0, std::string("\0", 1)); server.listen("*", 1235); - + TestClient client(PF_INET, SOCK_STREAM, 0); client.connect("127.0.0.1", 1235); @@ -107,9 +107,9 @@ int main(int argc, char** argv) { while(packetSeq != iterations) tthread::this_thread::sleep_for(tthread::chrono::milliseconds(20)); } - + exit(0); - + if (1) { // start server socket and connect int iterations = 100; diff --git a/test/src/test-url.cpp b/test/src/test-url.cpp index b3f9e28..5e5f4ea 100644 --- a/test/src/test-url.cpp +++ b/test/src/test-url.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) { #endif
HTTPServer::getInstance(8099, 8100);
-
+
std::string exeName = argv[0];
exeName = exeName.substr(exeName.find_last_of("\\/") + 1);
diff --git a/test/src/test-vxml-mmi-http.cpp b/test/src/test-vxml-mmi-http.cpp index 2b2cd25..35dc5d6 100644 --- a/test/src/test-vxml-mmi-http.cpp +++ b/test/src/test-vxml-mmi-http.cpp @@ -50,28 +50,29 @@ public: bool httpRecvRequest(const HTTPServer::Request& request) { std::cout << "RCVD:" << std::endl << request << std::flush; tthread::lock_guard<tthread::mutex> lock(Mutex); - + const Arabica::DOM::Document<std::string>& doc = request.data.at("content").node.getOwnerDocument(); // NameSpacingParser parser = NameSpacingParser::fromXML(request.content); switch(MMIEvent::getType(doc.getDocumentElement())) { - case MMIEvent::NEWCONTEXTRESPONSE: { - NewContextResponse* resp = new NewContextResponse(NewContextResponse::fromXML(doc.getDocumentElement())); - context = resp->context; - Replies[resp->requestId] = resp; - break; - } - case MMIEvent::STARTRESPONSE: { - StartResponse* resp = new StartResponse(StartResponse::fromXML(doc.getDocumentElement())); - Replies[resp->requestId] = resp; - } - default: ; + case MMIEvent::NEWCONTEXTRESPONSE: { + NewContextResponse* resp = new NewContextResponse(NewContextResponse::fromXML(doc.getDocumentElement())); + context = resp->context; + Replies[resp->requestId] = resp; + break; + } + case MMIEvent::STARTRESPONSE: { + StartResponse* resp = new StartResponse(StartResponse::fromXML(doc.getDocumentElement())); + Replies[resp->requestId] = resp; + } + default: + ; } - + Cond.notify_all(); - + HTTPServer::Reply reply(request); HTTPServer::reply(reply); - + return true; } void setURL(const std::string& url) { @@ -86,7 +87,7 @@ void printUsageAndExit(const char* progName) { if (progStr.find_last_of(PATH_SEPERATOR) != std::string::npos) { progStr = progStr.substr(progStr.find_last_of(PATH_SEPERATOR) + 1, progStr.length() - (progStr.find_last_of(PATH_SEPERATOR) + 1)); } - + printf("%s version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n", progStr.c_str()); printf("Usage\n"); printf("\t%s", progStr.c_str()); @@ -105,26 +106,26 @@ int main(int argc, char** argv) { std::string target; std::string document; - + if (argc < 2) printUsageAndExit(argv[0]); int option; while ((option = getopt(argc, argv, "t:")) != -1) { switch(option) { - case 't': - target = optarg; - break; - default: - printUsageAndExit(argv[0]); + case 't': + target = optarg; + break; + default: + printUsageAndExit(argv[0]); } } - + if (argc < optind) printUsageAndExit(argv[0]); - + document = argv[optind]; - + if (!boost::starts_with(document, "http")) document = "http://" + document; @@ -134,11 +135,11 @@ int main(int argc, char** argv) { // target = "http://130.83.163.167:9090/mmi"; // target = "http://localhost:9090/mmi"; - + MMIServlet servlet; HTTPServer::getInstance(4344, 0); HTTPServer::getInstance()->registerServlet("/mmi", &servlet); - + std::string source = servlet.url; NewContextRequest newCtxReq; @@ -147,12 +148,12 @@ int main(int argc, char** argv) { newCtxReq.requestId = uscxml::UUID::getUUID(); Requests[newCtxReq.requestId] = &newCtxReq; - + ISSUE_REQUEST(newCtxReq, false); while(Replies.find(newCtxReq.requestId) == Replies.end()) Cond.wait(Mutex); - + StartRequest startReq; startReq.context = context; startReq.source = source; @@ -160,7 +161,7 @@ int main(int argc, char** argv) { startReq.requestId = uscxml::UUID::getUUID(); startReq.contentURL.href = document; //"https://raw.githubusercontent.com/Roland-Taizun-Azhar/TaskAssistance-Project/master/WebContent/hello.vxml"; - + Requests[startReq.requestId] = &startReq; ISSUE_REQUEST(startReq, false); @@ -173,6 +174,6 @@ int main(int argc, char** argv) { } catch (std::exception e) { std::cout << e.what() << std::endl; } - - + + }
\ No newline at end of file diff --git a/test/src/test-vxml-mmi-socket.cpp b/test/src/test-vxml-mmi-socket.cpp index 99662c9..4db7109 100644 --- a/test/src/test-vxml-mmi-socket.cpp +++ b/test/src/test-vxml-mmi-socket.cpp @@ -23,18 +23,18 @@ bool testAddressParsing() { std::string protocol; std::string hostName; uint16_t port; - + { Socket::parseAddress("4343", protocol, hostName, port); assert(protocol == "tcp"); assert(hostName == "127.0.0.1"); assert(port == 4343); - + Socket::parseAddress("localhost:4343", protocol, hostName, port); assert(protocol == "tcp"); assert(hostName == "localhost"); assert(port == 4343); - + Socket::parseAddress("tcp://localhost:4343", protocol, hostName, port); assert(protocol == "tcp"); assert(hostName == "localhost"); @@ -52,16 +52,16 @@ bool testMMIEvents() { Arabica::DOM::Document<std::string> newCtxReqXML1 = newCtxReq.toXML(); Arabica::DOM::Document<std::string> newCtxReqXML2 = newCtxReq.toXML(true); - + // std::cout << newCtxReqXML1 << std::endl; // std::cout << newCtxReqXML2 << std::endl; - + NewContextRequest newCtxReq1 = NewContextRequest::fromXML(newCtxReqXML1.getDocumentElement()); NewContextRequest newCtxReq2 = NewContextRequest::fromXML(newCtxReqXML2.getDocumentElement()); - + assert(MMIEvent::getType(newCtxReqXML1.getDocumentElement()) == MMIEvent::NEWCONTEXTREQUEST); assert(MMIEvent::getType(newCtxReqXML2.getDocumentElement()) == MMIEvent::NEWCONTEXTREQUEST); - + assert(newCtxReq1.source == "localhost:3434"); assert(newCtxReq2.source == "localhost:3434"); assert(newCtxReq1.target == "localhost:1212"); @@ -109,28 +109,28 @@ int main(int argc, char** argv) { #endif testAddressParsing(); testMMIEvents(); - + // TestClient client(PF_INET, SOCK_STREAM, 0); // client.connect("epikur.local", 4343); std::string target = "localhost:4343"; std::string source = "localhost:4344"; - + TestServer server(PF_INET, SOCK_STREAM, 0); server.listen(source); - + // while(true) // sleep(1000); - + TestClient client(PF_INET, SOCK_STREAM, 0); client.connect(source); - + NewContextRequest newCtxReq; newCtxReq.source = source; newCtxReq.target = target; newCtxReq.requestId = UUID::getUUID(); - + _requests[newCtxReq.requestId] = &newCtxReq; - + Arabica::DOM::Document<std::string> newCtxReqXML = newCtxReq.toXML(true); std::stringstream newCtxReqXMLSS; newCtxReqXMLSS << newCtxReqXML; @@ -141,7 +141,7 @@ int main(int argc, char** argv) { // client.write(newCtxReqXMLSS.str().data(), newCtxReqXMLSS.str().size()); // client.write("\0", 1); } - + while(true) sleep(1000); diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index 3c20e76..27c69b2 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -98,10 +98,10 @@ int main(int argc, char** argv) { using namespace uscxml; try { - - #if defined(HAS_SIGNAL_H) && !defined(WIN32) + +#if defined(HAS_SIGNAL_H) && !defined(WIN32) signal(SIGPIPE, SIG_IGN); - #endif +#endif if (argc < 2) { exit(EXIT_FAILURE); @@ -116,23 +116,23 @@ int main(int argc, char** argv) { if (dfEnv) { delayFactor = strTo<double>(dfEnv); } - + int option; while ((option = getopt(argc, argv, "fd:")) != -1) { switch(option) { - case 'f': - withFlattening = true; - break; - case 'd': - delayFactor = strTo<double>(optarg); - break; - default: - break; + case 'f': + withFlattening = true; + break; + case 'd': + delayFactor = strTo<double>(optarg); + break; + default: + break; } } documentURI = argv[optind]; - + Interpreter interpreter; LOG(INFO) << "Processing " << documentURI << (withFlattening ? " FSM converted" : "") << (delayFactor ? "" : " with delays *= " + toStr(delayFactor)); if (withFlattening) { @@ -147,7 +147,7 @@ int main(int argc, char** argv) { Arabica::DOM::Document<std::string> document = interpreter.getDocument(); Arabica::DOM::Element<std::string> root = document.getDocumentElement(); Arabica::XPath::NodeSet<std::string> sends = InterpreterImpl::filterChildElements(interpreter.getNameSpaceInfo().xmlNSPrefix + "send", root, true); - + for (int i = 0; i < sends.size(); i++) { Arabica::DOM::Element<std::string> send = Arabica::DOM::Element<std::string>(sends[i]); if (HAS_ATTR(send, "delay")) { @@ -161,9 +161,9 @@ int main(int argc, char** argv) { } else if (HAS_ATTR(send, "delayexpr")) { std::string delayExpr = ATTR(send, "delayexpr"); send.setAttribute("delayexpr", - "(" + delayExpr + ".indexOf('ms', " + delayExpr + ".length - 2) !== -1 ? " - "(" + delayExpr + ".slice(0,-2) * " + toStr(delayFactor) + ") + \"ms\" : " - "(" + delayExpr + ".slice(0,-1) * 1000 * " + toStr(delayFactor) + ") + \"ms\")"); + "(" + delayExpr + ".indexOf('ms', " + delayExpr + ".length - 2) !== -1 ? " + "(" + delayExpr + ".slice(0,-2) * " + toStr(delayFactor) + ") + \"ms\" : " + "(" + delayExpr + ".slice(0,-1) * 1000 * " + toStr(delayFactor) + ") + \"ms\")"); std::cout << ATTR(send, "delayexpr") << std::endl; } } @@ -172,7 +172,7 @@ int main(int argc, char** argv) { std::cout << *issueIter << std::endl; } } - + if (interpreter) { W3CStatusMonitor* vm = new W3CStatusMonitor(); interpreter.addMonitor(vm); diff --git a/test/uscxml/test-jvoicexml.scxml b/test/uscxml/test-jvoicexml.scxml index 2e60cf3..706541b 100644 --- a/test/uscxml/test-jvoicexml.scxml +++ b/test/uscxml/test-jvoicexml.scxml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:vxml="http://www.w3.org/2001/vxml" datamodel="ecmascript"> <!-- get dump() function into datamodel --> - <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js"/> + <script src="file:///Users/sradomski/Desktop/dump.js"/> <script> vxmlTargetURL = "http://localhost:9090/mmi"; </script> diff --git a/test/w3c/confPromela.xsl b/test/w3c/confPromela.xsl new file mode 100644 index 0000000..1204d33 --- /dev/null +++ b/test/w3c/confPromela.xsl @@ -0,0 +1,779 @@ +<?xml version="1.0"?> +<!-- Copyright 1998-2003 W3C (MIT, ERCIM, Keio), All Rights Reserved. See http://www.w3.org/Consortium/Legal/. --> +<!-- Stefan Radomski 2014 --> +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:conf="http://www.w3.org/2005/scxml-conformance" + xmlns:scxml="http://www.w3.org/2005/07/scxml" + version="2.0"> + + + + +<!-- Copy everything that doesn't match other rules --> +<xsl:template match="/ | @* | node()"> + <xsl:copy> + <xsl:apply-templates select="@* | node()"/> + </xsl:copy> +</xsl:template> + +<!-- Success criteria --> + +<xsl:template match="//@conf:targetpass"> + <xsl:attribute name="target">pass</xsl:attribute> +</xsl:template> + +<xsl:template match="conf:pass"> + <final xmlns="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> +</xsl:template> + +<!-- Failure criteria --> + +<xsl:template match="//@conf:targetfail"> + <xsl:attribute name="target">fail</xsl:attribute> +</xsl:template> + +<xsl:template match="conf:fail"> + <final xmlns="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> +</final> +</xsl:template> + +<!-- datamodel --> +<xsl:template match="//@conf:datamodel"> + <xsl:attribute name="datamodel">promela</xsl:attribute> +</xsl:template> + + +<!-- creates id for <data> element, etc. --> +<!-- xsl:template match="//scxml:data[conf:array123]" --> +<xsl:template match="//@conf:id[../conf:array123]" priority="5"> + <xsl:attribute name="id">Var<xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="type">int[3]</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:id[../@conf:quoteExpr]" priority="5"> + <xsl:attribute name="id">Var<xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="type">string</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:id[../@conf:systemVarExpr]" priority="5"> + <xsl:attribute name="id">Var<xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="type">string</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:id[//@conf:idQuoteVal='1=internal']" priority="5"> + <xsl:attribute name="id">Var<xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="type">string</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:id"> + <xsl:attribute name="id">Var<xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="type">int</xsl:attribute> +</xsl:template> + +<!-- creates name for <param>, etc. --> +<xsl:template match="//@conf:name"> + <xsl:attribute name="name">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + + +<!-- creates location for <assign>, etc. --> +<xsl:template match="//@conf:location"> + <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> +</xsl:template> + + + + +<!-- expr is evaluated --> +<xsl:template match="//@conf:expr"> + <xsl:attribute name="expr"><xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- targetexpr is the corresponding ID --> +<xsl:template match="//@conf:targetVar"> + <xsl:attribute name="targetexpr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- expr is quoted --> +<xsl:template match="//@conf:quoteExpr"> + <xsl:attribute name="expr">'<xsl:value-of select="." />'</xsl:attribute> +</xsl:template> + +<!-- an expr that is the value of a variable --> +<xsl:template match="//@conf:varExpr"> + <xsl:attribute name="expr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- in EcmaScript, this is the same as varExpr --> +<xsl:template match="//@conf:varChildExpr"> + <xsl:attribute name="expr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- an expr that is the value of a system variable --> +<xsl:template match="//@conf:systemVarExpr"> + <xsl:attribute name="expr"><xsl:value-of select="." /></xsl:attribute> +</xsl:template> + + +<!-- an expr that is the value of a non-existent substructure of a variable --> +<xsl:template match="//@conf:varNonexistentStruct"> + <xsl:attribute name="expr">Var<xsl:value-of select="." />.bar</xsl:attribute> +</xsl:template> + + +<!-- this should return a value that cannot be assigned to a var. --> +<xsl:template match="//@conf:illegalExpr"> + <xsl:attribute name="expr">return</xsl:attribute> +</xsl:template> + +<!-- this should add 1 to the value of the specified variable --> +<xsl:template match="conf:incrementID"> + <assign xmlns="http://www.w3.org/2005/07/scxml"> + <xsl:attribute name="location">Var<xsl:value-of select="@id"/></xsl:attribute> + <xsl:attribute name="expr">Var<xsl:value-of select="@id"/> + 1</xsl:attribute> + </assign> + </xsl:template> + +<!-- this should concatenate the value of the id2 to id1 and assign the result to id1 --> +<xsl:template match="conf:concatVars"> + <assign xmlns="http://www.w3.org/2005/07/scxml"> + <xsl:attribute name="location">Var<xsl:value-of select="@id1"/></xsl:attribute> + <xsl:attribute name="expr">Var<xsl:value-of select="@id1"/> + Var<xsl:value-of select="@id2"/></xsl:attribute> + </assign> + </xsl:template> + +<!-- assigns the sum of the values of two vars to thefirst var--> +<xsl:template match="//conf:sumVars"> + <assign xmlns="http://www.w3.org/2005/07/scxml"> +<xsl:attribute name="location">Var<xsl:value-of select="@id1"/></xsl:attribute> +<xsl:attribute name="expr">Var<xsl:value-of select="@id1"/> + Var<xsl:value-of select="@id2"/></xsl:attribute> + </assign> + </xsl:template> + +<!-- this should return an illegal target for <send> causing a send error to be raised --> +<xsl:template match="//@conf:illegalTarget"> + <xsl:attribute name="target">baz</xsl:attribute> +</xsl:template> + +<!-- this returns an legal, but unreachable, target for <send> causing a send error to be raised --> +<xsl:template match="//@conf:unreachableTarget"> + <xsl:attribute name="target">#_scxml_foo</xsl:attribute> +</xsl:template> + +<!-- this produces illegal content for <send> causing the message to be rejected --> +<xsl:template match="//conf:illegalContent"> + <content xmlns="http://www.w3.org/2005/07/scxml"> xyz </content> +</xsl:template> + +<!-- a content element whose value is the string 'foo' --> +<xsl:template match="//conf:contentFoo"> + <content xmlns="http://www.w3.org/2005/07/scxml">foo</content> +</xsl:template> + +<xsl:template match="//conf:someInlineVal">123</xsl:template> + +<!-- this returns something that is guaranteed not to be the ID of the current session --> +<xsl:template match="//@conf:invalidSessionID"> + <xsl:attribute name="expr">27</xsl:attribute> +</xsl:template> + +<!-- this returns something that is guaranteed not to be a valid event I/O processor --> +<xsl:template match="//@conf:invalidSendType"> + <xsl:attribute name="type">27</xsl:attribute> +</xsl:template> + +<!-- same value in an expr --> +<xsl:template match="//@conf:invalidSendTypeExpr"> + <xsl:attribute name="expr">27</xsl:attribute> +</xsl:template> + +<!-- exprs that return the value of the event fields --> + +<xsl:template match="//@conf:eventName"> + <xsl:attribute name="expr">_event.name</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:eventType"> + <xsl:attribute name="expr">_event.type</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:eventSendid"> + <xsl:attribute name="expr">_event.sendid</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:eventField"> + <xsl:attribute name="expr">_event.<xsl:value-of select="."/></xsl:attribute> +</xsl:template> + +<!-- returns the raw message structure as a string --> +<xsl:template match="//@conf:eventRaw"> + <xsl:attribute name="expr">_event.raw</xsl:attribute> +</xsl:template> + + +<!-- returns the value of the specified item in _event.data --> +<xsl:template match="//@conf:eventDataFieldValue"> + <xsl:attribute name="expr">_event.data.<xsl:value-of select="."/></xsl:attribute> +</xsl:template> + +<!-- returns the value of a KVP specified by <param> from _event.data --> +<xsl:template match="//@conf:eventDataParamValue"> + <xsl:attribute name="expr">_event.data.<xsl:value-of select="."/></xsl:attribute> +</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.Var<xsl:value-of select="."/></xsl:attribute> +</xsl:template> + +<!-- returns the location of the scxml event i/o processor --> +<xsl:template match="//@conf:scxmlEventIOLocation"> + <xsl:attribute name="expr">_ioprocessors.scxml.location</xsl:attribute> +</xsl:template> + +<!-- templates for the expr versions of the send attributes --> + +<!-- eventexpr takes the value of the specified variable --> +<xsl:template match="//@conf:eventExpr"> + <xsl:attribute name="eventexpr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- targetexpr takes the value of the specified variable --> +<xsl:template match="//@conf:targetExpr"> + <xsl:attribute name="targetexpr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- typeexpr takes the value of the specified variable --> +<xsl:template match="//@conf:typeExpr"> + <xsl:attribute name="typeexpr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- delayexpr takes the value of the specified variable --> +<xsl:template match="//@conf:delayFromVar"> + <xsl:attribute name="delayexpr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- computes a delayexpr based on the value passed in. this lets platforms determine how long to delay timeout +events which cause the test to fail. The default value provided here is pretty long --> +<xsl:template match="//@conf:delay"> + <xsl:attribute name="delayexpr">'<xsl:value-of select="."/>s'</xsl:attribute> +</xsl:template> + +<!-- the specified variable is used as idlocation --> +<xsl:template match="//@conf:idlocation"> + <xsl:attribute name="idlocation">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- the specified variable is used as sendidexpr --> +<xsl:template match="//@conf:sendIDExpr"> + <xsl:attribute name="sendidexpr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- the specified variable is used as srcexpr --> +<xsl:template match="//@conf:srcExpr"> + <xsl:attribute name="srcexpr">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- the specified variable is used as namelist --> +<xsl:template match="//@conf:namelist"> + <xsl:attribute name="namelist">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- this produces a reference to an invalid namelist, i.e. on that should cause an error --> +<xsl:template match="//@conf:invalidNamelist"> + <xsl:attribute name="namelist">"foo</xsl:attribute> +</xsl:template> + + + + +<!-- transition conditions --> +<!-- the value is evaluated --> +<xsl:template match="//@conf:idVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)([=<>]=?)(.*)"> + <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/> + <xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> + <xsl:choose> + <xsl:when test="$op='='">==</xsl:when> + <xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise> + </xsl:choose> + <xsl:value-of select="regex-group(3)"/> + </xsl:matching-substring> + + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> +<!-- compare two variables --> +<xsl:template match="//@conf:varIdVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)([=<>]=?)(.*)"> + <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/> + <xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> + <xsl:choose> + <xsl:when test="$op='='">==</xsl:when> + <xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise> + </xsl:choose>Var<xsl:value-of select="regex-group(3)"/> + </xsl:matching-substring> + + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> + + +<!-- test that given var whose value was passed in via namelist has specific value. The value expr is evaluated --> +<xsl:template match="//@conf:namelistIdVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)([=<>]=?)(.*)"> + <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/> + <xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> + <xsl:choose> + <xsl:when test="$op='='">==</xsl:when> + <xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise> + </xsl:choose> + <xsl:value-of select="regex-group(3)"/> + </xsl:matching-substring> + + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> + +<!-- true if the two vars/ids have the same value --> +<xsl:template match="//@conf:VarEqVar"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)(\W+)([0-9]+)"> + <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/>==Var<xsl:value-of select="regex-group(3)"/> + </xsl:matching-substring> + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> + +<!-- true if the two vars/ids have the same value, which is a structure, not atomic --> +<xsl:template match="//@conf:VarEqVarStruct"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)(\W+)([0-9]+)"> + <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/>==Var<xsl:value-of select="regex-group(3)"/> + </xsl:matching-substring> + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> + +<!-- the value is quoted --> +<xsl:template match="//@conf:idQuoteVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)([=<>]=?)(.*)"> +<xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/><xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> +<xsl:choose> +<xsl:when test="$op='='">==</xsl:when> +<xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise></xsl:choose>'<xsl:value-of select="regex-group(3)"/>'</xsl:matching-substring> +</xsl:analyze-string> +</xsl:attribute> +</xsl:template> + +<!-- test on the value of two vars --> +<xsl:template match="//@conf:compareIDVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)([=<>]=?)([0-9+])"> + <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/> + <xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> + <xsl:choose> + <xsl:when test="$op='='">=</xsl:when> + <xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise> + </xsl:choose>Var<xsl:value-of select="regex-group(3)"/> + </xsl:matching-substring> + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> + +<!-- test that the specified var has the value specified by <conf:someInlineVal> --> +<xsl:template match="//@conf:idSomeVal"> + <xsl:attribute name="cond">Var<xsl:value-of select="." /> == 123</xsl:attribute> +</xsl:template> + +<!-- test that the event's name fieldhas the value specified --> +<xsl:template match="//@conf:eventNameVal"> + <xsl:attribute name="cond">_event.name == <xsl:text>'</xsl:text><xsl:value-of select="."/><xsl:text>'</xsl:text> + </xsl:attribute> + +</xsl:template> + +<xsl:template match="//@conf:eventvarVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)([=<>]=?)(.*)"> + <xsl:matching-substring>_event.data.Var<xsl:value-of select="regex-group(1)"/><xsl:text></xsl:text> + <xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> + <xsl:choose> + <xsl:when test="$op='='">==</xsl:when> + <xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise> + </xsl:choose> + <xsl:value-of select="regex-group(3)"/> + </xsl:matching-substring> + + </xsl:analyze-string> + </xsl:attribute> + +</xsl:template> + + + +<!-- return true if variable matches value of system var (var number is first arg, system var name +is the second argument --> +<xsl:template match="//@conf:idSystemVarVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)([=<>]=?)(.*)"> +<xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/><xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> +<xsl:choose> +<xsl:when test="$op='='">==</xsl:when> +<xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise></xsl:choose><xsl:value-of select="regex-group(3)"/></xsl:matching-substring> +</xsl:analyze-string> +</xsl:attribute> +</xsl:template> + +<!-- 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:template> + +<!-- test that _event.data is set to the value specified by <conf:someInlineVal> --> +<xsl:template match="//@conf:eventdataSomeVal"> + <xsl:attribute name="cond">_event.data == 123</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:emptyEventData"> + <xsl:attribute name="cond">!(_event.data)</xsl:attribute> +</xsl:template> + +<!-- return true if the _name system var has the specified quoted value --> +<xsl:template match="//@conf:nameVarVal"> + <xsl:attribute name="cond">_name == '<xsl:value-of select="."/>'</xsl:attribute> +</xsl:template> + +<!-- return true if first var's value is a prefix of the second var's value. Input has form "n m" where n and m are ints.--> +<xsl:template match="//@conf:varPrefix"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="(\w+)(\W)(\w+)"> + <xsl:matching-substring> + <!-- the underscore.string.startswith function compressed into one line below: + <xsl:text>(function(str, starts){ + if (starts == '') return true; + if (str == null || starts == null) return false; + str = String(str); starts = String(starts); + return str.length >= starts.length && str.slice(0, starts.length) == starts; + })(</xsl:text>Var<xsl:value-of select="regex-group(3)"/>, Var<xsl:value-of select="regex-group(1)"/><xsl:text>)</xsl:text> --> +<xsl:text>(function(str, starts){if (starts == '') return true;if (str == null || starts == null) return false;str = String(str); starts = String(starts);return str.length >= starts.length && str.slice(0, starts.length) == starts;})(</xsl:text>Var<xsl:value-of select="regex-group(3)"/>, Var<xsl:value-of select="regex-group(1)"/><xsl:text>)</xsl:text> + </xsl:matching-substring> + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:inState"> + <xsl:attribute name="cond">_x.states['<xsl:value-of select="."/>']</xsl:attribute> +</xsl:template> + +<!-- returns a value that cannot be converted into a Boolean --> +<xsl:template match="//@conf:nonBoolean"> + <xsl:attribute name="cond">return</xsl:attribute> +</xsl:template> + +<!-- true if id has a value --> +<xsl:template match="//@conf:isBound[//conf:array123]" priority="5"> + <xsl:attribute name="cond">Var<xsl:value-of select="." />[1]</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:isBound"> + <xsl:attribute name="cond">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- return true if specified var has been created but is not bound --> +<xsl:template match="//@conf:unboundVar"> + <xsl:attribute name="cond">!(Var<xsl:value-of select="." />)</xsl:attribute> +</xsl:template> + +<!-- true if system var has a value --> +<xsl:template match="//@conf:systemVarIsBound"> + <xsl:attribute name="cond"><xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- true if id does not have a value --> +<xsl:template match="//@conf:noValue"> + <xsl:attribute name="cond">!Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- always returns true --> +<xsl:template match="//@conf:true"> + <xsl:attribute name="cond">true</xsl:attribute> +</xsl:template> + +<!-- always returns false --> +<xsl:template match="//@conf:false"> + <xsl:attribute name="cond">false</xsl:attribute> +</xsl:template> + +<!-- returns true if all the required fields of _event are bound --> +<xsl:template match="//@conf:eventFieldsAreBound"> + <xsl:attribute name="cond">_event.name && _event.type</xsl:attribute> +</xsl:template> + +<!-- returns true if _event.data contains the specified item --> +<xsl:template match="//@conf:eventDataHasField"> + <xsl:attribute name="cond"><xsl:value-of select="."/> in _event.data</xsl:attribute> +</xsl:template> + +<!-- returns true if specified field of _event has no value --> +<xsl:template match="//@conf:eventFieldHasNoValue"> + <xsl:attribute name="cond">!(_event.<xsl:value-of select="." />)</xsl:attribute> +</xsl:template> + +<!-- true if the language of _event matches the processor's datamodel --> +<xsl:template match="//@conf:eventLanguageMatchesDatamodel"> + <xsl:attribute name="cond"> _event.language == 'promela'</xsl:attribute> +</xsl:template> + +<!-- true if _event was delivered on the specified i/o processor --> +<xsl:template match="//@conf:originTypeEq"> + <xsl:attribute name="cond"> _event.origintype == '<xsl:value-of select="."/>'</xsl:attribute> +</xsl:template> + + + + +<!-- scripting --> + +<xsl:template match="conf:script"> + <script xmlns="http://www.w3.org/2005/07/scxml">Var1 = 1</script> +</xsl:template> + + +<xsl:template match="//@conf:scriptGoodSrc"> + <xsl:attribute name="src">D:\W3C\SCXMLTests\test300.js</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:scriptBadSrc"> + <xsl:attribute name="src">D:\foo</xsl:attribute> +</xsl:template> + +<!-- sends an event back to the sender of the current event --> +<xsl:template match="conf:sendToSender"> + <send xmlns="http://www.w3.org/2005/07/scxml"> + <xsl:attribute name="event"><xsl:value-of select="@name" /></xsl:attribute> + <xsl:attribute name="targetexpr">_event.origin</xsl:attribute> + <xsl:attribute name="typeexpr">_event.origintype</xsl:attribute> + </send> +</xsl:template> + +<!-- foreach --> +<!-- this should produce an array containing 1 2 3 in that order --> +<xsl:template match="//conf:array123"> + Var<xsl:value-of select="../@conf:id" />[0] = 1; + Var<xsl:value-of select="../@conf:id" />[1] = 2; + Var<xsl:value-of select="../@conf:id" />[2] = 3; +</xsl:template> + +<!-- this uses the value of the indicated variable as the 'array' attribute --> +<xsl:template match="//@conf:arrayVar"> + <xsl:attribute name="array">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- in Python, this is the same as arrayVar --> +<xsl:template match="//@conf:arrayTextVar"> + <xsl:attribute name="array">Var<xsl:value-of select="."/></xsl:attribute> +</xsl:template> + + +<!-- this should produce expr that yields an array containing 1 2 3 in that order --> +<xsl:template match="//@conf:arrayExpr123"> + <xsl:attribute name="expr">1, 2, 3]</xsl:attribute> +</xsl:template> + +<!-- this should yield an expr that evaluates to something that is not a valid array --> +<xsl:template match="//@conf:illegalArray"> + <xsl:attribute name="expr">7</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:item"> + <xsl:attribute name="item">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- this should return something that cannot be an variable name --> +<xsl:template match="//@conf:illegalItem"> + <xsl:attribute name="item">'continue'</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:index"> + <xsl:attribute name="index">Var<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- this should add an extra item onto the end of the specified array, which +is of the same type as array123 --> +<xsl:template match="conf:extendArray"> + <assign xmlns="http://www.w3.org/2005/07/scxml"> + <xsl:attribute name="location">Var<xsl:value-of select="@id"/></xsl:attribute> + <xsl:attribute name="expr">[].concat(Var<xsl:value-of select="@id"/>, [4])</xsl:attribute> + </assign> + </xsl:template> + +<!-- this should create a multidimensional array all of whose cells are set to the specified value. Not +currently used for any tests --> +<xsl:template match="//@conf:multiDimensionalArrayExpr"> + <xsl:attribute name="expr">[[<xsl:value-of select="."/>,<xsl:value-of select="."/>],[<xsl:value-of select="."/>,<xsl:value-of select="."/>]]</xsl:attribute> +</xsl:template> + + +<!-- this should create a <foreach> statement that increments the values of the specified array. Not +currently used for any tests --> +<xsl:template match="conf:incrementArray"> + <xsl:variable name="targetArray">Var<xsl:value-of select="@id"/></xsl:variable> +<foreach xmlns="http://www.w3.org/2005/07/scxml"> + <xsl:attribute name="item">item</xsl:attribute> + <xsl:attribute name="index">index</xsl:attribute> + <xsl:attribute name="array"><xsl:value-of select="$targetArray"/></xsl:attribute> +<script> +<xsl:value-of select="$targetArray"/>[index][0] = <xsl:value-of select="$targetArray"/>[index][0] + 1 +<xsl:value-of select="$targetArray"/>[index][1] = <xsl:value-of select="$targetArray"/>[index][1] + 1 +</script> +</foreach> +</xsl:template> +<!-- this should return true iff each cell in the specified multidimensional array has the specified value. Not +currently used for any tests --> +<xsl:template match="//@conf:arrayVal"> + <xsl:attribute name="cond"> + <xsl:analyze-string select="." + regex="([0-9]+)(\W+)(.*)"> + <xsl:matching-substring> + <xsl:variable name="targetArray">Var<xsl:value-of select="regex-group(1)"/></xsl:variable> + <xsl:variable name="value"><xsl:value-of select="regex-group(3)"/></xsl:variable> +<xsl:value-of select="$targetArray"/>[0][0]== <xsl:value-of select="$value"/> && <xsl:value-of select="$targetArray"/>[0][1] == <xsl:value-of select="$value"/> && <xsl:value-of select="$targetArray"/>[1][0] == <xsl:value-of select="$value"/> && <xsl:value-of select="$targetArray"/>[1][1] == <xsl:value-of select="$value"/> +</xsl:matching-substring> + + </xsl:analyze-string> + </xsl:attribute> +</xsl:template> + +<!-- SITE SPECIFIC INFORMATION FOR BASIC HTTP EVENT I/O PROCESSOR +This template must be edited by each site that expects to test the Basic HTTP Event I/O +processor. Other templates for the Basic HTTP Event I/O tests are below it --> + +<xsl:template match="//@conf:testOnServer"> + <xsl:attribute name="target">SITE_SPECIFIC_ADDRESS<xsl:value-of select="." /></xsl:attribute> +</xsl:template> + +<!-- use this template to import or set up anything you need for the code in +the basic http tests. In the case of python, we have to import the regexp module.--> +<xsl:template match="conf:setUpHTTPTest"> +<!-- <script xmlns="http://www.w3.org/2005/07/scxml">import re</script> --> +</xsl:template> + +<!-- return an expression evaluating to the basic http access URI --> +<xsl:template match="//@conf:basicHTTPAccessURI"> + <xsl:attribute name="expr">_ioprocessors.basichttp.location</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:basicHTTPAccessURITarget"> + <xsl:attribute name="targetexpr">_ioprocessors.basichttp.location</xsl:attribute> +</xsl:template> + +<!-- generate an cond that evaluates to true if POST was used to send the message --> +<xsl:template match="//@conf:methodIsPost"> + <xsl:attribute name="cond">_event.raw.search('POST') !== -1</xsl:attribute> +</xsl:template> + +<!-- generate a namelist attribute containing all the ids listed in the attribute's value --> +<xsl:template match="//@conf:multipleNamelist"> + <xsl:attribute name="namelist"> + <xsl:analyze-string select="." regex="([0-9]+)"> +<xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/><xsl:text>
</xsl:text></xsl:matching-substring> +</xsl:analyze-string> +</xsl:attribute> +</xsl:template> + +<!-- generate a cond that evaluates to true if the event is external --> +<xsl:template match="//@conf:eventIsExternal"> + <xsl:attribute name="cond">_event.type == 'external'</xsl:attribute> +</xsl:template> + +<!-- returns true if _event/raw contains the var with the specified value --> +<xsl:template match="//@conf:eventIdParamHasValue"> + <xsl:attribute name="cond"><xsl:analyze-string select="." regex="(\S+)(\s+)(\S+)"> +<xsl:matching-substring>_event.raw.search(/Var<xsl:value-of select="regex-group(1)"/>=<xsl:value-of select="regex-group(3)"/>/) !== -1</xsl:matching-substring></xsl:analyze-string></xsl:attribute> +</xsl:template> + +<!-- returns true if _event/raw contains the param with the specified value --> +<xsl:template match="//@conf:eventNamedParamHasValue"> + <xsl:attribute name="cond"><xsl:analyze-string select="." regex="(\S+)(\s+)(\S+)"> + <xsl:matching-substring>_event.raw.search('<xsl:value-of select="regex-group(1)"/>=<xsl:value-of select="regex-group(3)"/>') !== -1</xsl:matching-substring></xsl:analyze-string></xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:messageBodyEquals"> + <xsl:attribute name="cond">_event.raw.search(/<xsl:value-of select="."/>/) !== -1</xsl:attribute> +</xsl:template> + + +<!-- the following templates produce an expr that extracts the relevant item from _event.raw --> +<xsl:template match="//@conf:getNamedParamVal"> + <xsl:attribute name="expr">_event.raw.match(/<xsl:value-of select="."/>=(\S+)$/)[1]</xsl:attribute> +</xsl:template> + +<!-- if input is 1, find param Var1, etc. --> +<xsl:template match="//@conf:getIDParamVal"> + <xsl:attribute name="expr">_event.raw.match(/Var<xsl:value-of select="."/>=(\S+)$/)[1]</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:getNthParamName"> + <xsl:attribute name="expr">txt.match(/\n\n(.*)/)[2].split('&')[<xsl:value-of select="."/>].split('=')[0]</xsl:attribute> +</xsl:template> + +<xsl:template match="//@conf:getNthParamVal"> + <xsl:attribute name="expr">txt.match(/\n\n(.*)/)[2].split('&')[<xsl:value-of select="."/>].split('=')[1]</xsl:attribute> +</xsl:template> + +<!-- this should produce an 'expr' that evaluates to a valid SCXML Message structure --> +<xsl:template match="//@conf:scxmlEventExpr"> + <xsl:attribute name="expr">'<message source="' + _ioprocessors['basichttp'] + '"' ++ 'xmlns:scxml="http://www.w3.org/2005/07/scxml" version="1.0" xmlns:xsi=:http://www.w3.org/2001/XMLSchema-instance" +xsi:schemaLocation="http://www.w3.org/2005/07/scxml scxml-message.xsd" sourcetype=:scxml"' ++' 'name="name"' + '"' + <xsl:value-of select="."/> + '"' + />'</xsl:attribute> + </xsl:template> + +<!-- this should produce a <content> tag containing material to use as the message body. This +content must include the address, so the far side can send a response back to us --> +<xsl:template match="conf:msgContent"> +<content xmlns="http://www.w3.org/2005/07/scxml"> + <xsl:attribute name="expr">'address=' + _ioprocessors['basichttp'] + "'"</xsl:attribute> + </content> +</xsl:template> + +<!-- this should produce a test on _event.raw that checks whether the body matches the +expression defined in the previous template. This may need to be tightened up because +it allows anything after the = --> +<xsl:template match="//@conf:msgIsBody"> + <xsl:attribute name="cond">_event.raw.match(/\n\naddress=(.*)$/)</xsl:attribute> +</xsl:template> +</xsl:stylesheet>
\ No newline at end of file diff --git a/test/w3c/convert-tests.sh b/test/w3c/convert-tests.sh index ea624ea..48aa452 100755 --- a/test/w3c/convert-tests.sh +++ b/test/w3c/convert-tests.sh @@ -5,26 +5,37 @@ cd $DIR TXMLS=`ls txml/*.txml` # see http://saxon.sourceforge.net/saxon6.5.1/using-xsl.html -for TXML in $TXMLS -do - DEST=ecma/`basename $TXML .txml`.scxml - echo "Processing $TXML to $DEST" - java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar $TXML confEcma.xsl -o:$DEST -done +# for TXML in $TXMLS +# do +# DEST=ecma/`basename $TXML .txml`.scxml +# echo "Processing $TXML to $DEST" +# java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar $TXML confEcma.xsl -o:$DEST +# done +# +# for TXML in $TXMLS +# do +# DEST=xpath/`basename $TXML .txml`.scxml +# echo "Processing $TXML to $DEST" +# java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar $TXML confXPath.xsl -o:$DEST +# done for TXML in $TXMLS do - DEST=xpath/`basename $TXML .txml`.scxml + DEST=promela/`basename $TXML .txml`.scxml echo "Processing $TXML to $DEST" - java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar $TXML confXPath.xsl -o:$DEST + java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar $TXML confPromela.xsl -o:$DEST done cp txml/*.txt ecma/ cp txml/*.txt xpath/ +cp txml/*.txt promela/ -find ./ecma -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv -find ./xpath -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv +# find ./ecma -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv +# find ./xpath -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv +find ./promela -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv +find ./promela -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv +# format all SCXML files SCXMLS=`find . -type f -name '*.scxml'` for SCXML in $SCXMLS do diff --git a/test/w3c/draft/calc.scxml b/test/w3c/draft/calc.scxml deleted file mode 100644 index bc6db8b..0000000 --- a/test/w3c/draft/calc.scxml +++ /dev/null @@ -1,157 +0,0 @@ -<?xml version="1.0"?> -<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="on" datamodel="ecmascript" name="calc"> - <datamodel> - <data id="long_expr"/> - <data id="short_expr" expr="0"/> - <data id="res"/> - </datamodel> - <state id="wrapper" initial="on"> - <state id="on" initial="ready"> - <onentry> - <send event="DISPLAY.UPDATE"/> - </onentry> - <state id="ready" initial="begin"> - <state id="begin"> - <transition event="OPER.MINUS" target="negated1"/> - <onentry> - <send event="DISPLAY.UPDATE"/> - </onentry> - </state> - <state id="result"> - </state> - <transition event="OPER" target="opEntered"/> - <transition event="DIGIT.0" target="zero1"> - <assign location="short_expr" expr="''"/> - </transition> - <transition event="DIGIT" target="int1"> - <assign location="short_expr" expr="''"/> - </transition> - <transition event="POINT" target="frac1"> - <assign location="short_expr" expr="''"/> - </transition> - </state> - <state id="negated1"> - <onentry> - <assign location="short_expr" expr="'-'"/> - <send event="DISPLAY.UPDATE"/> - </onentry> - <transition event="DIGIT.0" target="zero1"/> - <transition event="DIGIT" target="int1"/> - <transition event="POINT" target="frac1"/> - </state> - <state id="operand1"> - <state id="zero1"> - <transition event="DIGIT" cond="_event.name != 'DIGIT.0'" target="int1"/> - <transition event="POINT" target="frac1"/> - </state> - <state id="int1"> - <transition event="POINT" target="frac1"/> - <transition event="DIGIT"> - <assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)"/> - <send event="DISPLAY.UPDATE"/> - </transition> - <onentry> - <assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)"/> - <send event="DISPLAY.UPDATE"/> - </onentry> - </state> - <state id="frac1"> - <onentry> - <assign location="short_expr" expr="short_expr+'.'"/> - <send event="DISPLAY.UPDATE"/> - </onentry> - <transition event="DIGIT"> - <assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)"/> - <send event="DISPLAY.UPDATE"/> - </transition> - </state> - <transition event="OPER" target="opEntered"/> - </state> - <state id="opEntered"> - <transition event="OPER.MINUS" target="negated2"/> - <transition event="POINT" target="frac2"/> - <transition event="DIGIT.0" target="zero2"/> - <transition event="DIGIT" target="int2"/> - <onentry> - <raise event="CALC.SUB"/> - <send target="_internal" event="OP.INSERT"> - <param name="operator" expr="_event.name"/> - </send> - </onentry> - </state> - <state id="negated2"> - <onentry> - <assign location="short_expr" expr="'-'"/> - <send event="DISPLAY.UPDATE"/> - </onentry> - <transition event="DIGIT.0" target="zero2"/> - <transition event="DIGIT" target="int2"/> - <transition event="POINT" target="frac2"/> - </state> - <state id="operand2"> - <state id="zero2"> - <transition event="DIGIT" cond="_event.name != 'DIGIT.0'" target="int2"/> - <transition event="POINT" target="frac2"/> - </state> - <state id="int2"> - <transition event="DIGIT"> - <assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)"/> - <send event="DISPLAY.UPDATE"/> - </transition> - <onentry> - <assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)"/> - <send event="DISPLAY.UPDATE"/> - </onentry> - <transition event="POINT" target="frac2"/> - </state> - <state id="frac2"> - <onentry> - <assign location="short_expr" expr="short_expr +'.'"/> - <send event="DISPLAY.UPDATE"/> - </onentry> - <transition event="DIGIT"> - <assign location="short_expr" expr="short_expr +_event.name.substr(_event.name.lastIndexOf('.')+1)"/> - <send event="DISPLAY.UPDATE"/> - </transition> - </state> - <transition event="OPER" target="opEntered"> - <raise event="CALC.SUB"/> - <raise event="OP.INSERT"/> - </transition> - <transition event="EQUALS" target="result"> - <raise event="CALC.SUB"/> - <raise event="CALC.DO"/> - </transition> - </state> - <transition event="C" target="on"/> - </state> - <transition event="CALC.DO"> - <assign location="short_expr" expr="''+ res"/> - <assign location="long_expr" expr="''"/> - <assign location="res" expr="0"/> - </transition> - <transition event="CALC.SUB"> - <if cond="short_expr!=''"> - <assign location="long_expr" expr="long_expr+'('+short_expr+')'"/> - </if> - <assign location="res" expr="eval(long_expr)"/> - <assign location="short_expr" expr="''"/> - <send event="DISPLAY.UPDATE"/> - </transition> - <transition event="DISPLAY.UPDATE"> - <!--log level="0" label="'result'" expr=".short_expr==''?res:short_expr" / --> - </transition> - <transition event="OP.INSERT"> - <log level="0" expr="_event.data[0]"/> - <if cond="_event.data[0] == 'OPER.PLUS'"> - <assign location="long_expr" expr="long_expr+'+'"/> - <elseif cond="_event.data[0]=='OPER.MINUS'"/> - <assign location="long_expr" expr="long_expr+'-'"/> - <elseif cond="_event.data[0]=='OPER.STAR'"/> - <assign location="long_expr" expr="long_expr+'*'"/> - <elseif cond="_event.data[0]=='OPER.DIV'"/> - <assign location="long_expr" expr="long_expr+'/'"/> - </if> - </transition> - </state> -</scxml> diff --git a/test/w3c/ecma/test403c.scxml b/test/w3c/ecma/test403c.scxml index 8bb126d..f583851 100644 --- a/test/w3c/ecma/test403c.scxml +++ b/test/w3c/ecma/test403c.scxml @@ -17,20 +17,20 @@ <transition event="event2"/> </state> <state id="p0s2"> - <transition event="event1" target="p0s1"> + <transition event="event1" target="p0s1" this="1"> <raise event="event2"/> </transition> </state> <state id="p0s3"> <!-- this transition should be blocked by the one in p0s2--> - <transition event="event1" target="fail"/> + <transition event="event1" target="fail" this="2"/> <!-- this transition will preempt the one that p0s2 inherits from an ancestor --> <transition event="event2" target="s1"/> </state> <state id="p0s4"> <!-- this transition never gets preempted, should fire twice --> - <transition event="*"> + <transition event="*" this="3"> <assign location="Var1" expr="Var1 + 1"/> </transition> </state> diff --git a/test/w3c/promela/robots.txt b/test/w3c/promela/robots.txt new file mode 100644 index 0000000..9be2782 --- /dev/null +++ b/test/w3c/promela/robots.txt @@ -0,0 +1,96 @@ +# +# robots.txt for http://www.w3.org/ +# +# $Id: robots.txt,v 1.67 2014-06-25 13:06:01 ddavis Exp $ +# + +# For use by search.w3.org +User-agent: W3C-gsa +Disallow: /Out-Of-Date + +User-agent: W3T_SE +Disallow: /Out-Of-Date + +User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT; MS Search 4.0 Robot) +Disallow: / + +# W3C Link checker +User-agent: W3C-checklink +Disallow: + +# the following settings apply to all bots +User-agent: * +# Blogs - WordPress +# https://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization +Disallow: /*/wp-admin/ +Disallow: /*/wp-includes/ +Disallow: /*/wp-content/plugins/ +Disallow: /*/wp-content/cache/ +Disallow: /*/wp-content/themes/ +Disallow: /blog/*/trackback/ +Disallow: /blog/*/feed/ +Disallow: /blog/*/comments/ +Disallow: /blog/*/category/*/* +Disallow: /blog/*/*/trackback/ +Disallow: /blog/*/*/feed/ +Disallow: /blog/*/*/comments/ +Disallow: /blog/*/*? +Disallow: /community/trackback/ +Disallow: /community/feed/ +Disallow: /community/comments/ +Disallow: /community/category/*/* +Disallow: /community/*/trackback/ +Disallow: /community/*/feed/ +Disallow: /community/*/comments/ +Disallow: /community/*/category/*/* +Disallow: /community/*? +Disallow: /Consortium/Offices/trackback/ +Disallow: /Consortium/Offices/feed/ +Disallow: /Consortium/Offices/comments/ +Disallow: /Consortium/Offices/category/*/* +Disallow: /Consortium/Offices/*/trackback/ +Disallow: /Consortium/Offices/*/feed/ +Disallow: /Consortium/Offices/*/comments/ +Disallow: /Consortium/Offices/*? +# Wikis - Mediawiki +# https://www.mediawiki.org/wiki/Manual:Robots.txt +Disallow: /wiki/index.php? +Disallow: /wiki/index.php/Help +Disallow: /wiki/index.php/MediaWiki +Disallow: /wiki/index.php/Special: +Disallow: /wiki/index.php/Template +Disallow: /wiki/skins/ +Disallow: /*/wiki/index.php? +Disallow: /*/wiki/index.php/Help +Disallow: /*/wiki/index.php/MediaWiki +Disallow: /*/wiki/index.php/Special: +Disallow: /*/wiki/index.php/Template +# various other access-controlled or expensive areas +Disallow: /2004/ontaria/basic +Disallow: /Team/ +Disallow: /Project +Disallow: /Web +Disallow: /Systems +Disallow: /History +Disallow: /Out-Of-Date +Disallow: /2002/02/mid +Disallow: /mid/ +Disallow: /2005/06/blog/ +Disallow: /2004/08/W3CTalks +Disallow: /2007/11/Talks/search +Disallow: /People/all/ +Disallow: /RDF/Validator/ARPServlet +Disallow: /2003/03/Translations/byLanguage +Disallow: /2003/03/Translations/byTechnology +Disallow: /2005/11/Translations/Query +Disallow: /2000/06/webdata/xslt +Disallow: /2000/09/webdata/xslt +Disallow: /2005/08/online_xslt/xslt +Disallow: /Bugs/ +Disallow: /Search/Mail/Public/ +Disallow: /2006/02/chartergen +Disallow: /2004/01/pp-impl +Disallow: /Consortium/supporters +Disallow: /2007/08/pyRdfa/ +Disallow: /WAI/PF/comments/ +Disallow: /participate/conferences.xml diff --git a/test/w3c/promela/test144.scxml b/test/w3c/promela/test144.scxml new file mode 100644 index 0000000..18055c4 --- /dev/null +++ b/test/w3c/promela/test144.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that events are inserted into the queue in the order in which they are raised. If +foo occurs before bar, success, otherwise failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition event="foo" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="bar" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test147.scxml b/test/w3c/promela/test147.scxml new file mode 100644 index 0000000..de4e35e --- /dev/null +++ b/test/w3c/promela/test147.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the first clause that evaluates to true - and only that clause - is executed. +Only one event should be raised, and it should be bar --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <if cond="false"> + <raise event="foo"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + <elseif cond="true"/> + <raise event="bar"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + <else/> + <raise event="baz"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </if> + <raise event="bat"/> + </onentry> + <transition event="bar" cond="Var1==1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test148.scxml b/test/w3c/promela/test148.scxml new file mode 100644 index 0000000..fafb41a --- /dev/null +++ b/test/w3c/promela/test148.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the else clause executes if <if> and <elseif> evaluate to false. +Baz should be the only event generated by the <if>. bat is raised to catch the case where the <else> clause +fails and baz is not generated, i.e. it makes sure that the test doesn't hang. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <if cond="false"> + <raise event="foo"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + <elseif cond="false"/> + <raise event="bar"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + <else/> + <raise event="baz"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </if> + <raise event="bat"/> + </onentry> + <transition event="baz" cond="Var1==1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test149.scxml b/test/w3c/promela/test149.scxml new file mode 100644 index 0000000..a11083e --- /dev/null +++ b/test/w3c/promela/test149.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that neither if clause executes, so that bat is the only event raised. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <if cond="false"> + <raise event="foo"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + <elseif cond="false"/> + <raise event="bar"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </if> + <raise event="bat"/> + </onentry> + <transition event="bat" cond="Var1==0" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test150.scxml b/test/w3c/promela/test150.scxml new file mode 100644 index 0000000..7e4ca52 --- /dev/null +++ b/test/w3c/promela/test150.scxml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach causes a new variable to be declared if 'item' doesn't already exist. Also +test that it will use an existing var if it does exist. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int"/> + <data id="Var2" type="int"/> + <data id="Var3" type="int[3]"> + + Var3[0] = 1; + Var3[1] = 2; + Var3[2] = 3; + + </data> + </datamodel> + <state id="s0"> + <onentry> + <!-- first use declared variables --> + <foreach item="Var1" index="Var2" array="Var3"/> + <raise event="foo"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <onentry> + <!-- now use undeclared variables --> + <foreach item="Var4" index="Var5" array="Var3"/> + <raise event="bar"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s2"/> + </state> + <state id="s2"> + <!-- check that var4 is bound --> + <transition cond="Var4" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test151.scxml b/test/w3c/promela/test151.scxml new file mode 100644 index 0000000..ef380c9 --- /dev/null +++ b/test/w3c/promela/test151.scxml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach causes a new variable to be declared if 'item' doesn't already exist. Also +test that it will use an existing var if it does exist. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int"/> + <data id="Var2" type="int"/> + <data id="Var3" type="int[3]"> + + Var3[0] = 1; + Var3[1] = 2; + Var3[2] = 3; + + </data> + </datamodel> + <state id="s0"> + <onentry> + <!-- first use declared variables --> + <foreach item="Var1" index="Var2" array="Var3"/> + <raise event="foo"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <onentry> + <!-- now use undeclared variables --> + <foreach item="Var4" index="Var5" array="Var3"/> + <raise event="bar"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s2"/> + </state> + <state id="s2"> + <!-- check that var5 is bound --> + <transition cond="Var5" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test152.scxml b/test/w3c/promela/test152.scxml new file mode 100644 index 0000000..2fd3abe --- /dev/null +++ b/test/w3c/promela/test152.scxml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an illegal array or item value causes error.execution and results in executable content +not being executed. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <data id="Var2" type="int"/> + <data id="Var3" type="int"/> + <data id="Var4" type="int" expr="7"/> + <data id="Var5" type="int[3]"> + + Var5[0] = 1; + Var5[1] = 2; + Var5[2] = 3; + + </data> + </datamodel> + <state id="s0"> + <onentry> + <!-- invalid array, legal item --> + <foreach item="Var2" index="Var3" array="Var4"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </foreach> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <!-- illegal item, legal array --> + <foreach item="'continue'" index="Var3" array="Var5"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </foreach> + <raise event="bar"/> + </onentry> + <transition event="error.execution" target="s2"/> + <transition event="bar" target="fail"/> + </state> + <state id="s2"> + <!-- check that var1 has its original value (so executable content never got executed --> + <transition cond="Var1==0" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test153.scxml b/test/w3c/promela/test153.scxml new file mode 100644 index 0000000..4721606 --- /dev/null +++ b/test/w3c/promela/test153.scxml @@ -0,0 +1,46 @@ +<?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 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <!-- contains the previous value --> + <data id="Var2" type="int"/> + <!-- the item which will contain the current value --> + <data id="Var3" type="int[3]"> + + Var3[0] = 1; + Var3[1] = 2; + Var3[2] = 3; + + </data> + <data id="Var4" type="int" expr="1"/> + <!-- 1 if success, 0 if failure --> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var3"> + <if cond="Var1<Var2"> + <assign location="Var1" expr="Var2"/> + <else/> + <!-- values are out of order, record failure --> + <assign location="Var4" expr="0"/> + </if> + </foreach> + </onentry> + <!-- check that var1 has its original value --> + <transition cond="Var4==0" target="fail"/> + <transition target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test155.scxml b/test/w3c/promela/test155.scxml new file mode 100644 index 0000000..ec76992 --- /dev/null +++ b/test/w3c/promela/test155.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach executes the executable content once for each item in the list '(1,2,3)'. The executable +content sums the items into var1 so it should be 6 at the end --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <data id="Var2" type="int"/> + <data id="Var3" type="int[3]"> + + Var3[0] = 1; + Var3[1] = 2; + Var3[2] = 3; + + </data> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var3"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + Var2"/> + </foreach> + </onentry> + <transition cond="Var1==6" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test156.scxml b/test/w3c/promela/test156.scxml new file mode 100644 index 0000000..b07d289 --- /dev/null +++ b/test/w3c/promela/test156.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an error causes the foreach to stop execution. The second piece of executable content +should cause an error, so var1 should be incremented only once --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <data id="Var2" type="int"/> + <data id="Var3" type="int[3]"> + + Var3[0] = 1; + Var3[1] = 2; + Var3[2] = 3; + + </data> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var3"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + <!-- assign an illegal value to a non-existent var --> + <assign location="Var5" expr="return"/> + </foreach> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test158.scxml b/test/w3c/promela/test158.scxml new file mode 100644 index 0000000..d921652 --- /dev/null +++ b/test/w3c/promela/test158.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that executable content executes in document order. if event1 occurs then event2, succeed, otherwise fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <raise event="event1"/> + <raise event="event2"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test159.scxml b/test/w3c/promela/test159.scxml new file mode 100644 index 0000000..f59d1f9 --- /dev/null +++ b/test/w3c/promela/test159.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that any error raised by an element of executable content causes all subsequent elements to be skipped. +The send tag will raise an error so var1 should not be incremented. If it is fail, otherwise succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="thisWillFail" target="baz"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onentry> + <transition cond="Var1==1" target="fail"/> + <transition target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test172.scxml b/test/w3c/promela/test172.scxml new file mode 100644 index 0000000..bd99e91 --- /dev/null +++ b/test/w3c/promela/test172.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that eventexpr uses the current value of var1, not its initial value --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="string" expr="'event1'"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="'event2'"/> + <send eventexpr="Var1"/> + </onentry> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test173.scxml b/test/w3c/promela/test173.scxml new file mode 100644 index 0000000..cb3728e --- /dev/null +++ b/test/w3c/promela/test173.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that targetexpr uses the current value of var1, not its initial value +(If it uses the initial value, it will generate an error. If it uses the current value, event1 will be raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="27"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="'#_internal'"/> + <send targetexpr="Var1" event="event1"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test174.scxml b/test/w3c/promela/test174.scxml new file mode 100644 index 0000000..1e44370 --- /dev/null +++ b/test/w3c/promela/test174.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that typeexpr uses the current value of var1, not its initial value +(If it uses the initial value, it will generate an error. If it uses the current value, event1 will be raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="27"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="'http://www.w3.org/TR/scxml/#SCXMLEventProcessor'"/> + <send typeexpr="Var1" event="event1"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test175.scxml b/test/w3c/promela/test175.scxml new file mode 100644 index 0000000..9cd732f --- /dev/null +++ b/test/w3c/promela/test175.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that delayexpr uses the current value of var1, not its initial value +(If it uses the initial value, event2 will be generated first, before event1. If it uses the current value, +event1 will be raised first. Succeed if event1 occurs before event2, otherwise fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="string" expr="'0s'"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="'1s'"/> + <send delayexpr="Var1" event="event2"/> + <send delayexpr="'.5s'" event="event1"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="event2" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test176.scxml b/test/w3c/promela/test176.scxml new file mode 100644 index 0000000..d79b32e --- /dev/null +++ b/test/w3c/promela/test176.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <param> uses the current value of var1, not its initial value. If the value of +aParam in event1 is 2 so that var2 gets set to 2, success, otherwise failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="2"/> + <send event="event1"> + <param name="aParam" expr="Var1"/> + </send> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.data.aParam"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var2==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test178.scxml b/test/w3c/promela/test178.scxml new file mode 100644 index 0000000..5256cd3 --- /dev/null +++ b/test/w3c/promela/test178.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that multiple key/value pairs are included, even when the keys are the same. +This is a manual test. The tester must look at the log output and verify that both +keys are there. (This test uses the SCXML Event I/O processor, which is the only +one that all platforms must support. It does not specify the message format, so +we cannot test _event.raw directly. Therefore we print it out for visual +inspection.) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="event1"> + <param name="Var1" expr="2"/> + <param name="Var1" expr="3"/> + </send> + </onentry> + <transition event="event1" target="final"> + <log label="_event " expr="_event.raw"/> + </transition> + <transition event="*" target="fail"/> + </state> + <final id="final"/> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test179.scxml b/test/w3c/promela/test179.scxml new file mode 100644 index 0000000..c81030c --- /dev/null +++ b/test/w3c/promela/test179.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <content> can be used to populate body of a message --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="event1"> + <content>123</content> + </send> + </onentry> + <transition event="event1" cond="_event.data == 123" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test183.scxml b/test/w3c/promela/test183.scxml new file mode 100644 index 0000000..53ec8c7 --- /dev/null +++ b/test/w3c/promela/test183.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <send> stores the value of the sendid in idlocation. If it does, +var1 has a value and we pass. Otherwise we fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="event1" idlocation="Var1"/> + </onentry> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test185.scxml b/test/w3c/promela/test185.scxml new file mode 100644 index 0000000..8cb877c --- /dev/null +++ b/test/w3c/promela/test185.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <send> respects the delay specification. If it does, event1 arrives before event2 + and we pass. Otherwise we fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="event2" delayexpr="'1s'"/> + <send event="event1"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test186.scxml b/test/w3c/promela/test186.scxml new file mode 100644 index 0000000..d8c30ea --- /dev/null +++ b/test/w3c/promela/test186.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <send> evals its args when it is evaluated, not when the delay interval expires and the +message is actually sent. If it does, aParam will have the value of 1 (even though var1 has been incremented +in the interval.) If var2 ends up == 1, we pass. Otherwise we fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="event1" delayexpr="'1s'"> + <param name="aParam" expr="Var1"/> + </send> + <assign location="Var1" expr="2"/> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.data.aParam"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var2==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test187.scxml b/test/w3c/promela/test187.scxml new file mode 100644 index 0000000..1400694 --- /dev/null +++ b/test/w3c/promela/test187.scxml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that delayed <send> is not sent if the sending session terminates. In this case, +a subscript is invoked which sends the event childToParent delayed by 1 second, and then terminates. The +parent session, should not receive childToParent. If it does, we fail. Otherwise the +10 sec timer expires and we pass --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delayexpr="'1s'"/> + </onentry> + <invoke type="scxml"> + <content> + <!-- exit before the delayed send can execute --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent" delayexpr="'.5s'"/> + </onentry> + <transition target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent" target="fail"/> + <transition event="timeout" target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test189.scxml b/test/w3c/promela/test189.scxml new file mode 100644 index 0000000..b1bbf2a --- /dev/null +++ b/test/w3c/promela/test189.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_internal as a target of <send> puts the event on the internal queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <!-- goes to the external queue --> + <send event="event2"/> + <!-- to the internal queue --> + <send event="event1" target="#_internal"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" target="pass"/> + <transition event="event2" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test190.scxml b/test/w3c/promela/test190.scxml new file mode 100644 index 0000000..2143e85 --- /dev/null +++ b/test/w3c/promela/test190.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_scxml_sessionid as a target of <send> puts the event on the external queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first). we have to make sure that event2 +is actually delivered. The delayed <send> makes sure another event is generated (so the test doesn't hang) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="string" expr="'#_scxml_'"/> + <data id="Var2" type="string" expr="_sessionid"/> + </datamodel> + <state id="s0"> + <onentry> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + Var2"/> + <!-- goes to the external queue --> + <send event="event2" targetexpr="Var1"/> + <!-- to the internal queue --> + <raise event="event1"/> + <!-- this should get added to the external queue after event2 --> + <send event="timeout"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <!-- now check that we get event2 and not a timeout --> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test191.scxml b/test/w3c/promela/test191.scxml new file mode 100644 index 0000000..760caf9 --- /dev/null +++ b/test/w3c/promela/test191.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_parent works as a target of <send> . a subscript is invoked and sends the event +childToParent to its parent session (ths session) using #_parent as the target. If we get this event, we +pass, otherwise we fail. The timer insures that some event is generated and that the test does not hang. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="scxml"> + <content> + <!-- send an event to the parent session using #_parent as the target --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + </onentry> + <transition target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test192.scxml b/test/w3c/promela/test192.scxml new file mode 100644 index 0000000..0a50aed --- /dev/null +++ b/test/w3c/promela/test192.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_invokeid works as a target of <send> . A child script is invoked and sends us +childToParent once its running. Then we send it the event parentToChild using its invokeid as the target. +If it receives this event, it sends sends the event eventReceived to its parent session (ths session). +If we get this event, we pass, otherwise the child script eventually times out sends invoke.done and we fail. +We also set a timeout in this process to make sure the test doesn't hang --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="scxml" id="invokedChild"> + <content> + <!-- let the parent session know we're running by sending childToParent, then wait for parentToChild. + If we get it, send eventReceived. If we don't we eventually time out --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + <send event="timeout" delay="3s"/> + </onentry> + <transition event="parentToChild" target="subFinal"> + <send target="#_parent" event="eventReceived"/> + </transition> + <transition event="timeout" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timeout" target="fail"/> + <transition event="done.invoke" target="fail"/> + <state id="s01"> + <transition event="childToParent" target="s02"> + <send target="#_invokedChild" event="parentToChild"/> + </transition> + </state> + <state id="s02"> + <transition event="eventReceived" target="pass"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test193.scxml b/test/w3c/promela/test193.scxml new file mode 100644 index 0000000..aa2f297 --- /dev/null +++ b/test/w3c/promela/test193.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that omitting target and targetexpr of <send> when using the +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="promela"> + <state id="s0"> + <onentry> + <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="event1" target="fail"/> + <transition event="internal" target="s1"/> + </state> + <state id="s1"> + <transition event="event1" target="pass"/> + <transition event="timeout" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test194.scxml b/test/w3c/promela/test194.scxml new file mode 100644 index 0000000..b9be1a2 --- /dev/null +++ b/test/w3c/promela/test194.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that specifying an illegal target for <send> causes the event error.execution to be raised. If it does, +we succeed. Otherwise we eventually timeout and fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <!-- should cause an error --> + <send target="baz" event="event2"/> + <!-- this will get added to the external event queue after the error has been raised --> + <send event="timeout"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test198.scxml b/test/w3c/promela/test198.scxml new file mode 100644 index 0000000..2a45282 --- /dev/null +++ b/test/w3c/promela/test198.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that if type is not provided <send> uses the scxml event i/o processor. The only way to tell +what processor was used is to look at the origintype of the resulting 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="promela"> + <state id="s0"> + <onentry> + <send event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="event1" cond=" _event.origintype == 'http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test199.scxml b/test/w3c/promela/test199.scxml new file mode 100644 index 0000000..dbea699 --- /dev/null +++ b/test/w3c/promela/test199.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that using an invalid send type results in error.execution --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send type="27" event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test200.scxml b/test/w3c/promela/test200.scxml new file mode 100644 index 0000000..e4503fb --- /dev/null +++ b/test/w3c/promela/test200.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor supports the scxml event i/o processor --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test201.scxml b/test/w3c/promela/test201.scxml new file mode 100644 index 0000000..d517776 --- /dev/null +++ b/test/w3c/promela/test201.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor supports the basic http event i/o processor. This is an optional +test since platforms are not required to support basic http event i/o --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" targetexpr="_ioprocessors.basichttp.location" event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test205.scxml b/test/w3c/promela/test205.scxml new file mode 100644 index 0000000..604b311 --- /dev/null +++ b/test/w3c/promela/test205.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor doesn't change the message. We can't test that it never does this, but +at least we can check that the event name and included data are the same as we sent. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="event1"> + <param name="aParam" expr="1"/> + </send> + <send event="timeout"/> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var1" expr="_event.data.aParam"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test207.scxml b/test/w3c/promela/test207.scxml new file mode 100644 index 0000000..4adbfca --- /dev/null +++ b/test/w3c/promela/test207.scxml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that that we can't cancel an event in another session. We invoke a child process. It notifies +us when it has generated a delayed event with sendid foo. We try to cancel foo. The child process sends us event + event success if the event is not cancelled, event fail otherwise. This doesn't test that there is absolutely no way to cancel an event +raised in another session, but the spec doesn't define any way to refer to an event in another process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delayexpr="'2s'"/> + </onentry> + <invoke type="scxml"> + <content> + <!-- when invoked, we raise a delayed event1 with sendid 'foo' and notify our parent. Then we wait. + If event1 occurs, the parent hasn't succeeded in canceling it and we return pass. If event2 occurs + it means event1 was canceled (because event2 is delayed longer than event1) and we return 'fail'. --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send event="event1" id="foo" delayexpr="'1s'"/> + <send event="event2" delayexpr="'1.5s'"/> + <send target="#_parent" event="childToParent"/> + </onentry> + <transition event="event1" target="subFinal"> + <send target="#_parent" event="pass"/> + </transition> + <transition event="*" target="subFinal"> + <send target="#_parent" event="fail"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <state id="s01"> + <transition event="childToParent" target="s02"> + <cancel sendid="foo"/> + </transition> + </state> + <state id="s02"> + <transition event="pass" target="pass"/> + <transition event="fail" target="fail"/> + <transition event="timeout" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test208.scxml b/test/w3c/promela/test208.scxml new file mode 100644 index 0000000..72f57a6 --- /dev/null +++ b/test/w3c/promela/test208.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that cancel works. We cancel delayed event1. If cancel works, we get event2 first and pass. If +we get event1 or an error first, cancel didn't work and we fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send id="foo" event="event1" delayexpr="'1s'"/> + <send event="event2" delayexpr="'1.5s'"/> + <cancel sendid="foo"/> + </onentry> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test210.scxml b/test/w3c/promela/test210.scxml new file mode 100644 index 0000000..6b692be --- /dev/null +++ b/test/w3c/promela/test210.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that sendidexpr works with cancel. If it takes the most recent value of var1, it should cancel +delayed event1. Thus we get event2 first and pass. If we get event1 or an error first, cancel didn't work and we fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="string" expr="'bar'"/> + </datamodel> + <state id="s0"> + <onentry> + <send id="foo" event="event1" delayexpr="'1s'"/> + <send event="event2" delayexpr="'1.5s'"/> + <assign location="Var1" expr="'foo'"/> + <cancel sendidexpr="Var1"/> + </onentry> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test215.scxml b/test/w3c/promela/test215.scxml new file mode 100644 index 0000000..1a0819b --- /dev/null +++ b/test/w3c/promela/test215.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that typexpr is evaluated at runtime. If the original value of var1 is used, the invocation +will fail (test215sub1.scxml is not of type 'foo', even if the platform supports foo as a type). If +the runtime value is used, the invocation will succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="string" expr="'foo'"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + <assign location="Var1" expr="'http://www.w3.org/TR/scxml/'"/> + </onentry> + <invoke typeexpr="Var1"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml initial="subFinal" datamodel="promela" version="1.0"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test216.scxml b/test/w3c/promela/test216.scxml new file mode 100644 index 0000000..6a9aaa4 --- /dev/null +++ b/test/w3c/promela/test216.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that srcexpr is evaluated at runtime. If the original value of var1 is used, the invocation +will fail (assuming that there is no script named 'foo'). If +the runtime value is used, the invocation will succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="string" expr="'foo'"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + <assign location="Var1" expr="'file:test216sub1.scxml'"/> + </onentry> + <invoke srcexpr="Var1" type="http://www.w3.org/TR/scxml"/> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test216sub1.scxml b/test/w3c/promela/test216sub1.scxml new file mode 100644 index 0000000..9a5d74e --- /dev/null +++ b/test/w3c/promela/test216sub1.scxml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="promela"> + <final id="final"/> +</scxml> diff --git a/test/w3c/promela/test220.scxml b/test/w3c/promela/test220.scxml new file mode 100644 index 0000000..25bb26b --- /dev/null +++ b/test/w3c/promela/test220.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the scxml type is supported. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test223.scxml b/test/w3c/promela/test223.scxml new file mode 100644 index 0000000..5317ac7 --- /dev/null +++ b/test/w3c/promela/test223.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that idlocation is supported. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var1"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test224.scxml b/test/w3c/promela/test224.scxml new file mode 100644 index 0000000..3892083 --- /dev/null +++ b/test/w3c/promela/test224.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the automatically generated id has the form stateid.platformid. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + <data id="Var2" type="string" expr="'s0.'"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var1"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml version="1.0" initial="subFinal" datamodel="promela"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <transition cond="(function(str, starts){if (starts == '') return true;if (str == null || starts == null) return false;str = String(str); starts = String(starts);return str.length >= starts.length && str.slice(0, starts.length) == starts;})(Var1, Var2)" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test225.scxml b/test/w3c/promela/test225.scxml new file mode 100644 index 0000000..25aa2f1 --- /dev/null +++ b/test/w3c/promela/test225.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the automatically generated id is unique, we call invoke twice and compare the ids. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var1"> + <content> + <scxml initial="subFinal1" version="1.0" datamodel="promela"> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var2"> + <content> + <scxml initial="subFinal2" version="1.0" datamodel="promela"> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1==Var2" target="fail"/> + <transition target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test226.scxml b/test/w3c/promela/test226.scxml new file mode 100644 index 0000000..7ab32d8 --- /dev/null +++ b/test/w3c/promela/test226.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- this is basically just a test that invoke works correctly and that you can pass data +to the invoked process. If the invoked session finds aParam==1, it exits, signalling +success. otherwise it will hang and the timeout in this doc signifies failure. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test226sub1.scxml"> + <param name="Var1" expr="1"/> + </invoke> + <transition event="varBound" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test226sub1.scxml b/test/w3c/promela/test226sub1.scxml new file mode 100644 index 0000000..3d7869a --- /dev/null +++ b/test/w3c/promela/test226sub1.scxml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, if var1 has a value notify parent. Then terminate. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="final"> + <send target="#_parent" event="varBound"/> + </transition> + <transition target="final"/> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/promela/test228.scxml b/test/w3c/promela/test228.scxml new file mode 100644 index 0000000..9771a9e --- /dev/null +++ b/test/w3c/promela/test228.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the invokeid is included in events returned from the invoked process. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" id="foo"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="s1"> + <assign location="Var1" expr="_event.invokeid"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1=='foo'" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test229.scxml b/test/w3c/promela/test229.scxml new file mode 100644 index 0000000..3ba733a --- /dev/null +++ b/test/w3c/promela/test229.scxml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that autofoward works. If the child process receives back a copy of the +childToParent event that it sends to this doc, it sends eventReceived, signalling success. (Note +that this doc is not required to process that event explicitly. It should be forwarded in any case.) Otherwise +it eventually times out and the done.invoke signals failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" autoforward="true"> + <content> + <!-- when invoked, send childToParent to parent. + If it is forwarded back to us, send + eventReceived to signal success and terminate. + Otherwise wait for timer to expire and terminate. --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send target="#_parent" event="childToParent"/> + <send event="timeout" delay="3s"/> + </onentry> + <transition event="childToParent" target="subFinal"> + <send target="#_parent" event="eventReceived"/> + </transition> + <transition event="*" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent"/> + <transition event="eventReceived" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test230.scxml b/test/w3c/promela/test230.scxml new file mode 100644 index 0000000..ee97cef --- /dev/null +++ b/test/w3c/promela/test230.scxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a manual test that an autofowarded event has the same fields and values as the original event. +the child process sends the parent process an event which is forwarded back to it. +Both the parent and child process print out the contents of the event. The tester +must check if they are the same and report his result. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" autoforward="true"> + <content> + <!-- when invoked, send childToParent to parent. If it is forwarded back to us, print out its + fields and terminate. --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send target="#_parent" event="childToParent"/> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="childToParent" target="subFinal"> + <log label="name is " expr="_event.name"/> + <log label="type is " expr="_event.type"/> + <log label="sendid is " expr="_event.sendid"/> + <log label="origin is " expr="_event.origin"/> + <log label="origintype is " expr="_event.origintype"/> + <log label="invokeid is " expr="_event.invokeid"/> + <log label="data is " expr="_event.data"/> + </transition> + <transition event="*" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timeout" target="final"/> + <state id="s01"> + <transition event="childToParent" target="s02"> + <log label="name is " expr="_event.name"/> + <log label="type is " expr="_event.type"/> + <log label="sendid is " expr="_event.sendid"/> + <log label="origin is " expr="_event.origin"/> + <log label="origintype is " expr="_event.origintype"/> + <log label="invokeid is " expr="_event.invokeid"/> + <log label="data is " expr="_event.data"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s02"> + <!-- wait till we get the done event to ensure that the child process has time to print out its results --> + <transition event="done.invoke" target="final"/> + </state> + </state> + <final id="final"/> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test232.scxml b/test/w3c/promela/test232.scxml new file mode 100644 index 0000000..2c8a8aa --- /dev/null +++ b/test/w3c/promela/test232.scxml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a parent process can receive multiple events from a child process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"> + <onentry> + <send target="#_parent" event="childToParent1"/> + <send target="#_parent" event="childToParent2"/> + </onentry> + </final> + </scxml> + </content> + </invoke> + <transition event="timeout" target="fail"/> + <state id="s01"> + <transition event="childToParent1" target="s02"/> + </state> + <state id="s02"> + <transition event="childToParent2" target="s03"/> + </state> + <state id="s03"> + <transition event="done.invoke" target="pass"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test233.scxml b/test/w3c/promela/test233.scxml new file mode 100644 index 0000000..3087e1f --- /dev/null +++ b/test/w3c/promela/test233.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that finalize markup runs before the event is processed. The invoked process will +return 2 in _event.data.aParam, so that new value should be in force when we select +the transtitions. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"> + <onentry> + <send target="#_parent" event="childToParent"> + <param name="aParam" expr="2"/> + </send> + </onentry> + </final> + </scxml> + </content> + <finalize> + <assign location="Var1" expr="_event.data.aParam"/> + </finalize> + </invoke> + <transition event="childToParent" cond="Var1==2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test234.scxml b/test/w3c/promela/test234.scxml new file mode 100644 index 0000000..ee59cad --- /dev/null +++ b/test/w3c/promela/test234.scxml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that only finalize markup in the invoking state runs. the first invoked process will +return 2 in _event.data.aParam, while second invoked process sleeps without returning any events. +Only the first finalize should execute. So when we get to s1 var1 should have value 2 but +var2 should still be set to 1 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="p0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + <data id="Var2" type="int" expr="1"/> + </datamodel> + <parallel id="p0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="p01"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml version="1.0" initial="subFinal1" datamodel="promela"> + <final id="subFinal1"> + <onentry> + <send target="#_parent" event="childToParent"> + <param name="aParam" expr="2"/> + </send> + </onentry> + </final> + </scxml> + </content> + <finalize> + <assign location="Var1" expr="_event.data.aParam"/> + </finalize> + </invoke> + <transition event="childToParent" cond="Var1==2" target="s1"/> + <transition event="childToParent" target="fail"/> + </state> + <state id="p02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml version="1.0" initial="sub0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="subFinal2"/> + </state> + <final id="subFinal2"/> + </scxml> + </content> + <finalize> + <assign location="Var2" expr="_event.data.aParam"/> + </finalize> + </invoke> + </state> + </parallel> + <state id="s1"> + <transition cond="Var2==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test235.scxml b/test/w3c/promela/test235.scxml new file mode 100644 index 0000000..95b5827 --- /dev/null +++ b/test/w3c/promela/test235.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that done.invoke.id event has the right id. the invoked child terminates immediately +and should generate done.invoke.foo --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" id="foo"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke.foo" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test236.scxml b/test/w3c/promela/test236.scxml new file mode 100644 index 0000000..600b7f4 --- /dev/null +++ b/test/w3c/promela/test236.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that done.invoke.id event is the last event we receive. the invoked process sends childToParent +in the exit handler of its final state. We should get it before the done.invoke, and we should get no +events after the done.invoke. Hence timeout indicates success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delayexpr="'2s'"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"> + <onexit> + <send target="#_parent" event="childToParent"/> + </onexit> + </final> + </scxml> + </content> + </invoke> + <transition event="childToParent" target="s1"/> + <transition event="done.invoke" target="fail"/> + </state> + <state id="s1"> + <!-- here we should get done.invoke --> + <transition event="done.invoke" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <transition event="timeout" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test237.scxml b/test/w3c/promela/test237.scxml new file mode 100644 index 0000000..d23fc20 --- /dev/null +++ b/test/w3c/promela/test237.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that cancelling works. invoked child sleeps for two seconds, then terminates. We +sleep for 1 sec in s0, then move to s1. This should cause the invocation to get cancelled. +If we receive done.invoke, the invocation wasn't cancelled, and we fail. If we receive no events by +the time timeout2 fires, success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout1" delayexpr="'1s'"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <!-- when invoked, sleep for 2 secs then terminate. Parent will try to cancel this session --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send event="timeout" delayexpr="'2s'"/> + </onentry> + <transition event="timeout" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timeout1" target="s1"/> + </state> + <state id="s1"> + <onentry> + <send event="timeout2" delayexpr="'1.5s'"/> + </onentry> + <!-- here we should NOT get done.invoke --> + <transition event="done.invoke" target="fail"/> + <transition event="*" target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test239.scxml b/test/w3c/promela/test239.scxml new file mode 100644 index 0000000..dab80b9 --- /dev/null +++ b/test/w3c/promela/test239.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that markup can be specified both by 'src' and by <content> --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test239sub1.scxml"/> + <transition event="done.invoke" target="s02"/> + </state> + <state id="s02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <!-- identical to test239sub1.scxml. --> + <content> + <scxml version="1.0" initial="final" datamodel="promela"> + <final id="final"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test239sub1.scxml b/test/w3c/promela/test239sub1.scxml new file mode 100644 index 0000000..4f0ea59 --- /dev/null +++ b/test/w3c/promela/test239sub1.scxml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, just terminate. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="promela"> + <final id="final"/> +</scxml> diff --git a/test/w3c/promela/test240.scxml b/test/w3c/promela/test240.scxml new file mode 100644 index 0000000..e586d4e --- /dev/null +++ b/test/w3c/promela/test240.scxml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that datamodel values can be specified both by 'namelist' and by <param>. +invoked child will return success if its Var1 is set to 1, failure otherwise. This +test will fail schema validation because of the multiple occurences of Var1, but +should run correctly. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var1"> + <content> + <scxml initial="sub01" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="sub01"> + <transition cond="Var1==1" target="subFinal1"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal1"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <transition event="success" target="s02"/> + <transition event="failure" target="fail"/> + </state> + <state id="s02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml initial="sub02" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="sub02"> + <transition cond="Var1==1" target="subFinal2"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal1"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="failure" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test241.scxml b/test/w3c/promela/test241.scxml new file mode 100644 index 0000000..dff2920 --- /dev/null +++ b/test/w3c/promela/test241.scxml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- The child process will return success ifits Var1 is set to 1, failure otherwise. For this test +we try passing in Var1 by param and by namelist and check that we either get two successes +or two failures. This test will fail schema validation due to multiple declarations of +Var1, but should run correctly. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var1"> + <content> + <scxml initial="sub01" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="sub01"> + <transition cond="Var1==1" target="subFinal1"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal1"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <transition event="success" target="s02"/> + <transition event="failure" target="s03"/> + </state> + <state id="s02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml initial="sub02" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="sub02"> + <transition cond="Var1==1" target="subFinal2"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal2"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <!-- we got success in s01, so we need to do so here --> + <transition event="success" target="pass"/> + <transition event="failure" target="fail"/> + </state> + <state id="s03"> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml initial="sub03" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="sub03"> + <transition cond="Var1==1" target="subFinal3"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal3"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal3"/> + </scxml> + </content> + </invoke> + <!-- we got failure in s01, so we need to do so here --> + <transition event="failure" target="pass"/> + <transition event="success" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test242.scxml b/test/w3c/promela/test242.scxml new file mode 100644 index 0000000..01ea8d0 --- /dev/null +++ b/test/w3c/promela/test242.scxml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that markup specified by 'src' and by <content> is treated the same way. That means that +either we get done.invoke in both cases or in neither case (in which case we timeout) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout1" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test242sub1.scxml"/> + <transition event="done.invoke" target="s02"/> + <transition event="timeout1" target="s03"/> + </state> + <state id="s02"> + <onentry> + <send event="timeout2" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <!-- identical to test242sub1.scxml. --> + <content> + <scxml version="1.0" initial="subFinal1" datamodel="promela"> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <!-- we got done.invoke last time, so we need it this time too --> + <transition event="done.invoke" target="pass"/> + <transition event="timeout2" target="fail"/> + </state> + <state id="s03"> + <onentry> + <send event="timeout3" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <!-- identical to test242sub1.scxml. --> + <content> + <scxml version="1.0" initial="subFinal2" datamodel="promela"> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <!-- we got timeout last time, so we need it this time too --> + <transition event="timeout3" target="pass"/> + <transition event="done.invoke" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test242sub1.scxml b/test/w3c/promela/test242sub1.scxml new file mode 100644 index 0000000..4f0ea59 --- /dev/null +++ b/test/w3c/promela/test242sub1.scxml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, just terminate. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="promela"> + <final id="final"/> +</scxml> diff --git a/test/w3c/promela/test243.scxml b/test/w3c/promela/test243.scxml new file mode 100644 index 0000000..c29d49f --- /dev/null +++ b/test/w3c/promela/test243.scxml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that datamodel values can be specified by param. +test240sub1 will return success ifits Var1 is set to 1, failure otherwise. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml version="1.0" initial="sub0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="sub0"> + <transition cond="Var1==1" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test244.scxml b/test/w3c/promela/test244.scxml new file mode 100644 index 0000000..84b6ec3 --- /dev/null +++ b/test/w3c/promela/test244.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that datamodel values can be specified by namelist. +invoked child will return success ifits Var1 is set to 1, failure otherwise. +This test will fail schema validation due to multiple occurrences of Var1, +but should run correctly. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var1"> + <content> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="sub0"> + <transition cond="Var1==1" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test245.scxml b/test/w3c/promela/test245.scxml new file mode 100644 index 0000000..5f00a42 --- /dev/null +++ b/test/w3c/promela/test245.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that non-existent datamodel values are not set. Var2 is not defined in +invoked child's datamodel. It will will return success if its Var2 remains unbound, failure otherwise. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var2" type="int" expr="3"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var2"> + <content> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <transition cond="Var2" target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test247.scxml b/test/w3c/promela/test247.scxml new file mode 100644 index 0000000..822f97d --- /dev/null +++ b/test/w3c/promela/test247.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we get done.invoke. timeout indicates failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml version="1.0" initial="subFinal" datamodel="promela"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="timeout" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test250.scxml b/test/w3c/promela/test250.scxml new file mode 100644 index 0000000..e3f6b7a --- /dev/null +++ b/test/w3c/promela/test250.scxml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the onexit handlers run in the invoked process if it is cancelled. This has to be a +manual test, since this process won't accept any events from the child process once it has been cancelled. +Tester must examine log output from child process to determine success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="foo"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0" initial="sub01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="subFinal"/> + <onexit> + <log expr="'Exiting sub0'"/> + </onexit> + <state id="sub01"> + <onexit> + <log expr="'Exiting sub01'"/> + </onexit> + </state> + </state> + <final id="subFinal"> + <onentry> + <log expr="'entering final state, invocation was not cancelled'"/> + </onentry> + </final> + </scxml> + </content> + </invoke> + <!-- this transition will cause the invocation to be cancelled --> + <transition event="foo" target="final"/> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/promela/test252.scxml b/test/w3c/promela/test252.scxml new file mode 100644 index 0000000..cb45517 --- /dev/null +++ b/test/w3c/promela/test252.scxml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we don't process any events received from the invoked process once it is cancelled. child +process tries to send us childToParent in an onexit handler. If we get it, we fail. +timeout indicates success. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delayexpr="'1s'"/> + </onentry> + <transition event="timeout" target="pass"/> + <transition event="childToParent" target="fail"/> + <transition event="done.invoke" target="fail"/> + <state id="s01"> + <onentry> + <send event="foo"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send event="timeout" delayexpr="'.5s'"/> + </onentry> + <transition event="timeout" target="subFinal"/> + <onexit> + <send target="#_parent" event="childToParent"/> + </onexit> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <!-- this transition will cause the invocation to be cancelled --> + <transition event="foo" target="s02"/> + </state> + <state id="s02"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test253.scxml b/test/w3c/promela/test253.scxml new file mode 100644 index 0000000..467f7ff --- /dev/null +++ b/test/w3c/promela/test253.scxml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the scxml event processor is used in both directions. If child process uses the +scxml event i/o processor to communicate with us, send it an event. It will send back success if +this process uses the scxml processor to send the message to it, otherwise failure. For this test we allow +'scxml' as an alternative to the full url. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <invoke type="scxml" id="foo"> + <content> + <!-- inform parent we're running then wait for it to send us an event. If it uses the scxml event i/o + processor to do so, return success, otherwise return failure. --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var2" type="int"/> + </datamodel> + <state id="sub0"> + <onentry> + <send target="#_parent" event="childRunning"/> + </onentry> + <transition event="parentToChild" target="sub1"> + <assign location="Var2" expr="_event.origintype"/> + </transition> + </state> + <state id="sub1"> + <transition cond="Var2=='http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition cond="Var2=='scxml'" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <state id="s01"> + <transition event="childRunning" target="s02"> + <assign location="Var1" expr="_event.origintype"/> + </transition> + </state> + <state id="s02"> + <transition cond="Var1=='http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="s03"> + <send target="#_foo" event="parentToChild"/> + </transition> + <transition cond="Var1=='scxml'" target="s03"> + <send target="#_foo" event="parentToChild"/> + </transition> + <transition target="fail"/> + </state> + <state id="s03"> + <transition event="success" target="pass"/> + <transition event="fail" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test276.scxml b/test/w3c/promela/test276.scxml new file mode 100644 index 0000000..3602bb0 --- /dev/null +++ b/test/w3c/promela/test276.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that values passed in from parent process override default values specified in the child, test276sub1.scxml. +The child returns event1 if var1 has value 1, event0 if it has default value 0. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <invoke type="scxml" src="file:test276sub1.scxml"> + <param name="Var1" expr="1"/> + </invoke> + <transition event="event1" target="pass"/> + <transition event="event0" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test276sub1.scxml b/test/w3c/promela/test276sub1.scxml new file mode 100644 index 0000000..a95592e --- /dev/null +++ b/test/w3c/promela/test276sub1.scxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- define var1 with default value 0. Parent will invoke this process setting var1 = 1. Return event1 if var1 == 1, event0 otherwise --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <transition cond="Var1==1" target="final"> + <send target="#_parent" event="event1"/> + </transition> + <transition target="final"> + <send target="#_parent" event="event0"/> + </transition> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/promela/test277.scxml b/test/w3c/promela/test277.scxml new file mode 100644 index 0000000..89090d2 --- /dev/null +++ b/test/w3c/promela/test277.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that platform creates undound variable if we assign an illegal value to it. Thus + we can assign to it later in state s1. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="return"/> + </datamodel> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="error.execution" cond="!(Var1)" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="Var1" expr="1"/> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test278.scxml b/test/w3c/promela/test278.scxml new file mode 100644 index 0000000..a2d613a --- /dev/null +++ b/test/w3c/promela/test278.scxml @@ -0,0 +1,23 @@ +<?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="promela"> + <!-- test that a variable can be accessed from a state that is outside its lexical scope --> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test279.scxml b/test/w3c/promela/test279.scxml new file mode 100644 index 0000000..8c12d30 --- /dev/null +++ b/test/w3c/promela/test279.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- testing that in case of early binding variables are assigned values at init time, before + the state containing them is visited --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test280.scxml b/test/w3c/promela/test280.scxml new file mode 100644 index 0000000..d43a883 --- /dev/null +++ b/test/w3c/promela/test280.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test late binding. var2 won't get bound until s1 is entered, so it shouldn't have a value in s0 and +accessing it should cause an error. It should get bound before the onentry code in s1 so it should be +possible access it there and assign its value to var1 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela" binding="late"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <transition cond="!(Var2)" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var2" type="int" expr="1"/> + </datamodel> + <onentry> + <assign location="Var1" expr="Var2"/> + </onentry> + <transition cond="Var1==Var2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test286.scxml b/test/w3c/promela/test286.scxml new file mode 100644 index 0000000..9b84ced --- /dev/null +++ b/test/w3c/promela/test286.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that assigment to a non-declared var causes an error. the transition on foo catches the case +where no 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="promela" initial="s0"> + <state id="s0"> + <onentry> + <assign location="foo.bar.baz " expr="1"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test287.scxml b/test/w3c/promela/test287.scxml new file mode 100644 index 0000000..2d22f15 --- /dev/null +++ b/test/w3c/promela/test287.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a simple test that a legal value may be assigned to a valid data model location --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0" initial="s0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="1"/> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test288.scxml b/test/w3c/promela/test288.scxml new file mode 100644 index 0000000..8e9b01a --- /dev/null +++ b/test/w3c/promela/test288.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a simple test that a legal value may be assigned to a valid data model location +using child content --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0" initial="s0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1">123</assign> + </onentry> + <transition cond="Var1 == 123" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test294.scxml b/test/w3c/promela/test294.scxml new file mode 100644 index 0000000..dd38f2d --- /dev/null +++ b/test/w3c/promela/test294.scxml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a param inside donedata ends up in the data field of the done event and +that content inside donedata sets the full value of the event.data field --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0" initial="s01"> + <transition event="done.state.s0" cond="_event.data.Var1==1" target="s1"> + </transition> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param name="Var1" expr="1"/> + </donedata> + </final> + </state> + <state id="s1" initial="s11"> + <transition event="done.state.s1" cond="_event.data == 'foo'" target="pass"> + </transition> + <transition event="done.state.s1" target="fail"> + </transition> + <state id="s11"> + <transition target="s12"/> + </state> + <final id="s12"> + <donedata> + <content xmlns:scxml="http://www.w3.org/2005/07/scxml">foo</content> + </donedata> + </final> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test298.scxml b/test/w3c/promela/test298.scxml new file mode 100644 index 0000000..0f623b7 --- /dev/null +++ b/test/w3c/promela/test298.scxml @@ -0,0 +1,32 @@ +<?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="promela" initial="s0"> + <datamodel> + <data id="Var1" type="int" 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"/> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param name="Var3" location="foo.bar.baz "/> + </donedata> + </final> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test301.scxml b/test/w3c/promela/test301.scxml new file mode 100644 index 0000000..f089387 --- /dev/null +++ b/test/w3c/promela/test301.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- the processor should reject this document because it can't download the script. +Therefore we fail if it runs at all. This test is valid only for datamodels that support scripting --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0"> + <script src="D:\foo"/> + <state id="s0"> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test302.scxml b/test/w3c/promela/test302.scxml new file mode 100644 index 0000000..a8161f8 --- /dev/null +++ b/test/w3c/promela/test302.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a script is evaluated at load time. <conf:script> shoudl assign the value 1 to +Var1. Hence, if script is evaluated at download time, Var1 has a value in the initial state s0. +This test is valid only for datamodels that support scripting --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <script xmlns:scxml="http://www.w3.org/2005/07/scxml">Var1 = 1</script> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test303.scxml b/test/w3c/promela/test303.scxml new file mode 100644 index 0000000..bf41d39 --- /dev/null +++ b/test/w3c/promela/test303.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- to test that scripts are run as part of executable content, we check that it changes the value of a var at the +right point. This test is valid only for datamodels that support scripting --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="2"/> + <script xmlns:scxml="http://www.w3.org/2005/07/scxml">Var1 = 1</script> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test304.scxml b/test/w3c/promela/test304.scxml new file mode 100644 index 0000000..1f8197a --- /dev/null +++ b/test/w3c/promela/test304.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a variable declared by a script can be accessed like any other part of the data model --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0" initial="s0"> + <script xmlns:scxml="http://www.w3.org/2005/07/scxml">Var1 = 1</script> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test307.scxml b/test/w3c/promela/test307.scxml new file mode 100644 index 0000000..91ad325 --- /dev/null +++ b/test/w3c/promela/test307.scxml @@ -0,0 +1,35 @@ +<?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" version="1.0" initial="s0" datamodel="promela" binding="late"> + <!-- with binding=late, in s0 we access a variable that isn't created until we get to s1. Then in s1 +we access a non-existent substructure of a variable. We use log tags to report the values that both operations +yield, and whether there are errors. This is a manual test, since the tester must report whether the output +is the same in the two cases --> + <state id="s0"> + <onentry> + <log label="entering s0 value of Var 1 is: " expr="Var1"/> + <raise event="foo"/> + </onentry> + <transition event="error" target="s1"> + <log label="error in state s0" expr="_event"/> + </transition> + <transition event="foo" target="s1"> + <log label="no error in s0" expr=""/> + </transition> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <onentry> + <log label="entering s1, value of non-existent substructure of Var 1 is: " expr="Var1.bar"/> + <raise event="bar"/> + </onentry> + <transition event="error" target="final"> + <log label="error in state s1" expr="_event"/> + </transition> + <transition event="bar" target="final"> + <log label="No error in s1" expr=""/> + </transition> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/promela/test309.scxml b/test/w3c/promela/test309.scxml new file mode 100644 index 0000000..fb1525c --- /dev/null +++ b/test/w3c/promela/test309.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an expression that cannot be interpreted as a boolean is treated as false --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0"> + <transition cond="return" target="fail"/> + <transition target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test310.scxml b/test/w3c/promela/test310.scxml new file mode 100644 index 0000000..bbab164 --- /dev/null +++ b/test/w3c/promela/test310.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- simple test of the in() predicate --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="p"> + <parallel id="p"> + <state id="s0"> + <transition cond="_x.states['s1']" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"/> + </parallel> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test311.scxml b/test/w3c/promela/test311.scxml new file mode 100644 index 0000000..7ee4a33 --- /dev/null +++ b/test/w3c/promela/test311.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that assignment to a non-existent location yields an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + <assign location="foo.bar.baz " expr="1"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test312.scxml b/test/w3c/promela/test312.scxml new file mode 100644 index 0000000..10bc8cf --- /dev/null +++ b/test/w3c/promela/test312.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that assignment with an illegal expr raises an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test313.scxml b/test/w3c/promela/test313.scxml new file mode 100644 index 0000000..b16fa2f --- /dev/null +++ b/test/w3c/promela/test313.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- this is a manual test. The processor is allowed to reject this doc, but if it executes it with its illegal +expression, it must raise an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test314.scxml b/test/w3c/promela/test314.scxml new file mode 100644 index 0000000..9fea77d --- /dev/null +++ b/test/w3c/promela/test314.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- this is a manual test because the processor is allowed to reject this document. But if it executes it, +it should not raise an error until it gets to s03 and evaluates the illegal expr --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0" initial="s01"> + <transition event="error.execution" target="fail"/> + <state id="s01"> + <transition target="s02"/> + </state> + <state id="s02"> + <transition target="s03"/> + </state> + <state id="s03"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test318.scxml b/test/w3c/promela/test318.scxml new file mode 100644 index 0000000..27651a4 --- /dev/null +++ b/test/w3c/promela/test318.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _event stays bound during the onexit and entry into the next state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela" name="machineName"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" target="s1"/> + </state> + <state id="s1"> + <onentry> + <raise event="bar"/> + <!-- _event should still be bound to 'foo' at this point --> + <assign location="Var1" expr="_event.name"/> + </onentry> + <transition cond="Var1=='foo'" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test319.scxml b/test/w3c/promela/test319.scxml new file mode 100644 index 0000000..2c7159e --- /dev/null +++ b/test/w3c/promela/test319.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _event is not bound before any event has been raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0" name="machineName"> + <state id="s0"> + <onentry> + <if cond="_event"> + <raise event="bound"/> + <else/> + <raise event="unbound"/> + </if> + </onentry> + <transition event="unbound" target="pass"/> + <transition event="bound" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test321.scxml b/test/w3c/promela/test321.scxml new file mode 100644 index 0000000..09c29dd --- /dev/null +++ b/test/w3c/promela/test321.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _sessionid is bound on startup --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" type="string" expr="_sessionid"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition cond="true" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test322.scxml b/test/w3c/promela/test322.scxml new file mode 100644 index 0000000..10bca29 --- /dev/null +++ b/test/w3c/promela/test322.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _sessionid remains bound to the same value throught the session. this means that it can't +be assigned to --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" type="string" expr="_sessionid"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <transition target="s1"/> + </state> + <state id="s1"> + <onentry> + <assign location="_sessionid" expr="'otherName'"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <transition cond="Var1==_sessionid" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test323.scxml b/test/w3c/promela/test323.scxml new file mode 100644 index 0000000..28952fa --- /dev/null +++ b/test/w3c/promela/test323.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _name is bound on startup --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela" name="machineName"> + <datamodel> + <data id="Var1" type="string" expr="_name"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition cond="true" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test324.scxml b/test/w3c/promela/test324.scxml new file mode 100644 index 0000000..12beb71 --- /dev/null +++ b/test/w3c/promela/test324.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _name stays bound till the session ends. This means that it cannot be assigned to --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela" name="machineName"> + <state id="s0"> + <transition cond="_name == 'machineName'" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="_name" expr="'otherName'"/> + </onentry> + <transition cond="_name == 'machineName'" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test325.scxml b/test/w3c/promela/test325.scxml new file mode 100644 index 0000000..38c892f --- /dev/null +++ b/test/w3c/promela/test325.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _ioprocessors is bound at startup. I'm not sure how to test for a set value or +how to test that the entries in it do represent I/O processors, since the set that each implementation +supports may be different. Suggestions welcome --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" type="string" expr="_ioprocessors"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test326.scxml b/test/w3c/promela/test326.scxml new file mode 100644 index 0000000..c649b8d --- /dev/null +++ b/test/w3c/promela/test326.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _ioprocessors stays bound till the session ends. This means that it cannot be assigned to --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" type="string" expr="_ioprocessors"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="s1"/> + <transition cond="true" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="_ioprocessors" expr="'otherName'"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <onentry> + <assign location="Var2" expr="_ioprocessors"/> + </onentry> + <transition cond="Var1==Var2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test329.scxml b/test/w3c/promela/test329.scxml new file mode 100644 index 0000000..6f6dd64 --- /dev/null +++ b/test/w3c/promela/test329.scxml @@ -0,0 +1,54 @@ +<?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="promela" name="machineName"> + <datamodel> + <data id="Var1" type="int"/> + <data id="Var2" type="int"/> + <data id="Var3" type="int"/> + <data id="Var4" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <!-- get _event bound so we can use it in s1--> + <raise event="foo"/> + <assign location="Var1" expr="_sessionid"/> + <assign location="_sessionid" expr="27"/> + </onentry> + <transition event="foo" cond="Var1==_sessionid" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="Var2" expr="_event"/> + <assign location="_event" expr="27"/> + </onentry> + <transition cond="Var2==_event" target="s2"/> + <transition target="fail"/> + </state> + <state id="s2"> + <onentry> + <assign location="Var3" expr="_name"/> + <assign location="_name" expr="27"/> + </onentry> + <transition cond="Var3==_name" target="s3"/> + <transition target="fail"/> + </state> + <state id="s3"> + <onentry> + <assign location="Var4" expr="_ioprocessors"/> + <assign location="_ioprocessors" expr="27"/> + </onentry> + <transition cond="Var4==_ioprocessors" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test330.scxml b/test/w3c/promela/test330.scxml new file mode 100644 index 0000000..20f0bee --- /dev/null +++ b/test/w3c/promela/test330.scxml @@ -0,0 +1,28 @@ +<?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="promela" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="_event.name && _event.type" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <send event="foo"/> + </onentry> + <transition event="foo" cond="_event.name && _event.type" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test331.scxml b/test/w3c/promela/test331.scxml new file mode 100644 index 0000000..cd85652 --- /dev/null +++ b/test/w3c/promela/test331.scxml @@ -0,0 +1,59 @@ +<?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" version="1.0" datamodel="promela" initial="s0" name="machineName"> + <!-- test that _event.type is set correctly for internal, platform, and external events --> + <datamodel> + <data id="Var1" type="string"/> + </datamodel> + <state id="s0"> + <onentry> + <!-- internal event --> + <raise event="foo"/> + </onentry> + <transition event="foo" target="s1"> + <assign location="Var1" expr="_event.type"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1=='internal'" target="s2"/> + <transition target="fail"/> + </state> + <state id="s2"> + <onentry> + <!-- this will generate an error, which is a platform event --> + <assign location="foo.bar.baz " expr="1"/> + </onentry> + <transition event="error" target="s3"> + <assign location="Var1" expr="_event.type"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s3"> + <transition cond="Var1=='platform'" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <onentry> + <!-- external event --> + <send event="foo"/> + </onentry> + <transition event="foo" target="s5"> + <assign location="Var1" expr="_event.type"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s5"> + <transition cond="Var1=='external'" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test332.scxml b/test/w3c/promela/test332.scxml new file mode 100644 index 0000000..74ffa55 --- /dev/null +++ b/test/w3c/promela/test332.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that sendid is present in error events triggered by send errors --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="promela" name="machineName"> + <datamodel> + <data id="Var1" type="int"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <!-- this will raise an error and also store the sendid in var1 --> + <send target="baz" event="foo" idlocation="Var1"/> + </onentry> + <transition event="error" target="s1"> + <!-- get the sendid out of the error event --> + <assign location="Var2" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <!-- make sure that the sendid in the error event matches the one generated when send executed --> + <transition cond="Var1==Var2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test333.scxml b/test/w3c/promela/test333.scxml new file mode 100644 index 0000000..f26c53c --- /dev/null +++ b/test/w3c/promela/test333.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- make sure sendid is blank in a non-error event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="promela" name="machineName"> + <state id="s0"> + <onentry> + <send event="foo"/> + </onentry> + <transition event="foo" cond="!(_event.sendid)" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test335.scxml b/test/w3c/promela/test335.scxml new file mode 100644 index 0000000..8d0a1ad --- /dev/null +++ b/test/w3c/promela/test335.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that origin field is blank for internal events --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="promela" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="!(_event.origin)" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test336.scxml b/test/w3c/promela/test336.scxml new file mode 100644 index 0000000..6b502ae --- /dev/null +++ b/test/w3c/promela/test336.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the origin field of an external event contains a URL that lets you send back to the originator. In +this case it's the same session, so if we get bar we succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0" name="machineName"> + <state id="s0"> + <onentry> + <send event="foo"/> + </onentry> + <transition event="foo" target="s1"> + <send xmlns:scxml="http://www.w3.org/2005/07/scxml" event="bar" targetexpr="_event.origin" typeexpr="_event.origintype"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <send event="baz"/> + </onentry> + <transition event="bar" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test337.scxml b/test/w3c/promela/test337.scxml new file mode 100644 index 0000000..64500af --- /dev/null +++ b/test/w3c/promela/test337.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that origintype is blank on internal events --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="!(_event.origintype)" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test338.scxml b/test/w3c/promela/test338.scxml new file mode 100644 index 0000000..244088a --- /dev/null +++ b/test/w3c/promela/test338.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that invokeid is set correctly in events received from an invoked process. timeout event catches the +case where the invoke doesn't work correctly --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="string"/> + <data id="Var2" type="string"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke idlocation="Var1" type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="sub0" version="1.0" datamodel="promela" name="machineName"> + <final id="sub0"> + <onentry> + <send target="#_parent" event="event1"/> + </onentry> + </final> + </scxml> + </content> + </invoke> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.invokeid"/> + </transition> + <transition event="event0" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1==Var2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test339.scxml b/test/w3c/promela/test339.scxml new file mode 100644 index 0000000..b91fc5f --- /dev/null +++ b/test/w3c/promela/test339.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that invokeid is blank in an event that wasn't returned from an invoked process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="!(_event.invokeid)" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test342.scxml b/test/w3c/promela/test342.scxml new file mode 100644 index 0000000..ab953e5 --- /dev/null +++ b/test/w3c/promela/test342.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that eventexpr works and sets the name field of the resulting 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="promela" name="machineName"> + <datamodel> + <data id="Var1" type="string" expr="'foo'"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send eventexpr="Var1"/> + </onentry> + <transition event="foo" target="s1"> + <assign location="Var2" expr="_event.name"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1==Var2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test343.scxml b/test/w3c/promela/test343.scxml new file mode 100644 index 0000000..38dac5c --- /dev/null +++ b/test/w3c/promela/test343.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that illegal <param> produces error.execution and empty event.data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0" initial="s01"> + <!-- we should get the error before the done event --> + <transition event="error.execution" target="s1"/> + <transition event="done.state.s0" target="fail"/> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param location="foo.bar.baz " name="someParam"/> + </donedata> + </final> + </state> + <!-- if we get here, we received the error event. Now check that the done + event has empty event.data --> + <state id="s1"> + <transition event="done.state.s0" cond="!(_event.data)" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test344.scxml b/test/w3c/promela/test344.scxml new file mode 100644 index 0000000..eb3c292 --- /dev/null +++ b/test/w3c/promela/test344.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a cond expression that cannot be evaluated as a +boolean cond expression evaluates to false and causes error.execution to be raised. +In some languages, any valid expression/object can be converted to a boolean, so conf:nonBoolean will +have to be mapped onto something that produces a syntax error or something similarly invalid --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0"> + <transition cond="return" target="fail"/> + <transition target="s1"/> + </state> + <state id="s1"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test346.scxml b/test/w3c/promela/test346.scxml new file mode 100644 index 0000000..5d8dc30 --- /dev/null +++ b/test/w3c/promela/test346.scxml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that any attempt to change the value of a system variable causes error.execution to be raised. +Event1..4 are there to catch the case where the error event is not raised. In cases where it is, we have +to dispose of eventn in the next state, hence the targetless transitions (which simply throw away the 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="promela" name="machineName"> + <state id="s0"> + <onentry> + <assign location="_sessionid" expr="'otherName'"/> + <raise event="event1"/> + </onentry> + <transition event="error.execution" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="_event" expr="'otherName'"/> + <raise event="event2"/> + </onentry> + <!-- throw out event1 if it's still around --> + <transition event="event1"/> + <transition event="error.execution" target="s2"/> + <!-- event1 would trigger this transition if we didn't drop it. We want this transition to have + a very general trigger to catch cases where the wrong error event was raised --> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <onentry> + <assign location="_ioprocessors" expr="'otherName'"/> + <raise event="event3"/> + </onentry> + <transition event="event2"/> + <transition event="error.execution" target="s3"/> + <transition event="*" target="fail"/> + </state> + <state id="s3"> + <onentry> + <assign location="_name" expr="'otherName'"/> + <raise event="event4"/> + </onentry> + <transition event="event3"/> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test347.scxml b/test/w3c/promela/test347.scxml new file mode 100644 index 0000000..3b79584 --- /dev/null +++ b/test/w3c/promela/test347.scxml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the scxml event I/O processor works by sending events back and forth between an invoked child +and its parent process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0" initial="s01"> + <invoke id="child" type="scxml"> + <content> + <scxml initial="sub0" version="1.0" datamodel="promela" name="machineName"> + <state id="sub0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_parent" event="childToParent"/> + </onentry> + <transition event="parentToChild" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <onentry> + <send delay="20s" event="timeout"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <transition event="childToParent" target="s02"/> + </state> + <state id="s02"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_child" event="parentToChild"/> + </onentry> + <transition event="done.invoke" target="pass"/> + <transition event="error" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test348.scxml b/test/w3c/promela/test348.scxml new file mode 100644 index 0000000..57d43d9 --- /dev/null +++ b/test/w3c/promela/test348.scxml @@ -0,0 +1,21 @@ +<?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" datamodel="promela" version="1.0"> + <!-- test that event param of send sets the name of the event --> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test349.scxml b/test/w3c/promela/test349.scxml new file mode 100644 index 0000000..57ac1cd --- /dev/null +++ b/test/w3c/promela/test349.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that value in origin field can be used to send an event back to the sender --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s2"> + <assign location="Var1" expr="_event.origin"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" targetexpr="Var1" event="s0Event2"/> + </onentry> + <transition event="s0Event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test350.scxml b/test/w3c/promela/test350.scxml new file mode 100644 index 0000000..7ae6fe8 --- /dev/null +++ b/test/w3c/promela/test350.scxml @@ -0,0 +1,28 @@ +<?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="promela" version="1.0"> + <datamodel> + <data id="Var1" type="string" expr="'#_scxml_'"/> + <data id="Var2" type="string" expr="_sessionid"/> + </datamodel> + <state id="s0"> + <onentry> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + Var2"/> + <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 xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test351.scxml b/test/w3c/promela/test351.scxml new file mode 100644 index 0000000..fb665ec --- /dev/null +++ b/test/w3c/promela/test351.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that sendid is set in event if present in send, blank otherwise --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int"/> + <data id="Var2" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" id="send1" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign location="Var1" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"> + </transition> + </state> + <state id="s1"> + <transition cond="Var1=='send1'" target="s2"/> + <transition target="fail"/> + </state> + <state id="s2"> + <onentry> + <send event="s0Event2"/> + </onentry> + <transition event="s0Event2" target="s3"> + <assign location="Var2" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s3"> + <transition cond="!Var2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test352.scxml b/test/w3c/promela/test352.scxml new file mode 100644 index 0000000..464ee32 --- /dev/null +++ b/test/w3c/promela/test352.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test the origintype is 'http://www.w3.org/TR/scxml/#SCXMLEventProcessor' --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign location="Var1" expr="_event.origintype"/> + </transition> + <transition event="*" target="fail"> + </transition> + </state> + <state id="s1"> + <transition cond="Var1=='http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test354.scxml b/test/w3c/promela/test354.scxml new file mode 100644 index 0000000..91932ca --- /dev/null +++ b/test/w3c/promela/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="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + <data id="Var2" type="int"/> + <data id="Var3" type="int"/> + </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>123</content> + </send> + </onentry> + <transition event="event2" cond="_event.data == 123" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test355.scxml b/test/w3c/promela/test355.scxml new file mode 100644 index 0000000..91c6ecf --- /dev/null +++ b/test/w3c/promela/test355.scxml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that default initial state is first in document order. If we enter s0 first we succeed, if s1, failure. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0"> + <state id="s0"> + <transition target="pass"/> + </state> + <state id="s1"> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test364.scxml b/test/w3c/promela/test364.scxml new file mode 100644 index 0000000..44ba527 --- /dev/null +++ b/test/w3c/promela/test364.scxml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that default initial states are entered when a compound state is entered. First we test +the 'initial' attribute, then the initial element, then default to the first child in document order. +If we get to s01111 we succeed, if any other state, failure. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" initial="s1" version="1.0"> + <state id="s1" initial="s11p112 s11p122"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s11" initial="s111"> + <state id="s111"/> + <parallel id="s11p1"> + <state id="s11p11" initial="s11p111"> + <state id="s11p111"/> + <state id="s11p112"> + <onentry> + <raise event="In-s11p112"/> + </onentry> + </state> + </state> + <state id="s11p12" initial="s11p121"> + <state id="s11p121"/> + <state id="s11p122"> + <transition event="In-s11p112" target="s2"/> + </state> + </state> + </parallel> + </state> + </state> + <state id="s2"> + <initial> + <transition target="s21p112 s21p122"/> + </initial> + <transition event="timeout" target="fail"/> + <state id="s21" initial="s211"> + <state id="s211"/> + <parallel id="s21p1"> + <state id="s21p11" initial="s21p111"> + <state id="s21p111"/> + <state id="s21p112"> + <onentry> + <raise event="In-s21p112"/> + </onentry> + </state> + </state> + <state id="s21p12" initial="s21p121"> + <state id="s21p121"/> + <state id="s21p122"> + <transition event="In-s21p112" target="s3"/> + </state> + </state> + </parallel> + </state> + </state> + <state id="s3"> + <transition target="fail"/> + <state id="s31"> + <state id="s311"> + <state id="s3111"> + <transition target="pass"/> + </state> + <state id="s3112"/> + <state id="s312"/> + <state id="s32"/> + </state> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test372.scxml b/test/w3c/promela/test372.scxml new file mode 100644 index 0000000..6062428 --- /dev/null +++ b/test/w3c/promela/test372.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that entering a final state generates done.state.parentid after executing the onentry elements. +Var1 should be set to 2 (but not 3) by the time the event is raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0" initial="s0final"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="done.state.s0" cond="Var1==2" target="pass"/> + <transition event="*" target="fail"/> + <final id="s0final"> + <onentry> + <assign location="Var1" expr="2"/> + </onentry> + <onexit> + <assign location="Var1" expr="3"/> + </onexit> + </final> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test375.scxml b/test/w3c/promela/test375.scxml new file mode 100644 index 0000000..a78a9d1 --- /dev/null +++ b/test/w3c/promela/test375.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that onentry handlers are executed in document order. event1 should be raised before event2 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <raise event="event1"/> + </onentry> + <onentry> + <raise event="event2"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test376.scxml b/test/w3c/promela/test376.scxml new file mode 100644 index 0000000..d3d81bc --- /dev/null +++ b/test/w3c/promela/test376.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that each onentry handler is a separate block. The <send> of event1 will cause an error but + the increment to var1 should happen anyways --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <send target="baz" event="event1"/> + </onentry> + <onentry> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onentry> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test377.scxml b/test/w3c/promela/test377.scxml new file mode 100644 index 0000000..d105bbe --- /dev/null +++ b/test/w3c/promela/test377.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that onexit handlers are executed in document order. event1 should be raised before event2 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0"> + <state id="s0"> + <onexit> + <raise event="event1"/> + </onexit> + <onexit> + <raise event="event2"/> + </onexit> + <transition target="s1"/> + </state> + <state id="s1"> + <transition event="event1" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test378.scxml b/test/w3c/promela/test378.scxml new file mode 100644 index 0000000..e1c74c0 --- /dev/null +++ b/test/w3c/promela/test378.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that each onexithandler is a separate block. The <send> of event1 will cause an error but + the increment to var1 should happen anyways --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0"> + <onexit> + <send target="baz" event="event1"/> + </onexit> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + <transition target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test387.scxml b/test/w3c/promela/test387.scxml new file mode 100644 index 0000000..769d69b --- /dev/null +++ b/test/w3c/promela/test387.scxml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the default history state works correctly. From initial state s3 we take a transition to s0's default +shallow history state. That should generate "enteringS011", which takes us to s4. In s4, we +transition to s1's default deep history state. We should end up in s122, generating "enteringS122". Otherwise failure.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s3" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <transition event="enteringS011" target="s4"/> + <transition event="*" target="fail"/> + <history type="shallow" id="s0HistShallow"> + <transition target="s01"/> + </history> + <history type="deep" id="s0HistDeep"> + <transition target="s022"/> + </history> + <state id="s01" initial="s011"> + <state id="s011"> + <onentry> + <raise event="enteringS011"/> + </onentry> + </state> + <state id="s012"> + <onentry> + <raise event="enteringS012"/> + </onentry> + </state> + </state> + <state id="s02" initial="s021"> + <state id="s021"> + <onentry> + <raise event="enteringS021"/> + </onentry> + </state> + <state id="s022"> + <onentry> + <raise event="enteringS022"/> + </onentry> + </state> + </state> + </state> + <state id="s1" initial="s11"> + <transition event="enteringS122" target="pass"/> + <transition event="*" target="fail"/> + <history type="shallow" id="s1HistShallow"> + <transition target="s11"/> + </history> + <history type="deep" id="s1HistDeep"> + <transition target="s122"/> + </history> + <state id="s11" initial="s111"> + <state id="s111"> + <onentry> + <raise event="enteringS111"/> + </onentry> + </state> + <state id="s112"> + <onentry> + <raise event="enteringS112"/> + </onentry> + </state> + </state> + <state id="s12" initial="s121"> + <state id="s121"> + <onentry> + <raise event="enteringS121"/> + </onentry> + </state> + <state id="s122"> + <onentry> + <raise event="enteringS122"/> + </onentry> + </state> + </state> + </state> + <state id="s3"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition target="s0HistShallow"/> + </state> + <state id="s4"> + <transition target="s1HistDeep"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test388.scxml b/test/w3c/promela/test388.scxml new file mode 100644 index 0000000..c6ffffc --- /dev/null +++ b/test/w3c/promela/test388.scxml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that history states works correctly. The counter Var1 counts how many times +we have entered s0. The initial state is s012. We then transition to s1, which transitions +to s0's deep history state. entering.s012 should be raised, otherwise failure. Then we transition +to s02, which transitions to s0's shallow history state. That should have value s01, and its initial +state is s011, so we should get entering.s011, otherwise failure.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s012" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onentry> + <!-- the first time through, go to s1, setting a timer just in case something hangs --> + <transition event="entering.s012" cond="Var1==1" target="s1"> + <send event="timeout" delay="2s"/> + </transition> + <!-- the second time, we should get entering.s012. If so, go to s2, otherwise fail --> + <transition event="entering.s012" cond="Var1==2" target="s2"/> + <transition event="entering" cond="Var1==2" target="fail"/> + <!-- the third time we should get entering-s011. If so, pass, otherwise fail --> + <transition event="entering.s011" cond="Var1==3" target="pass"/> + <transition event="entering" cond="Var1==3" target="fail"/> + <!-- if we timeout, the state machine is hung somewhere, so fail --> + <transition event="timeout" target="fail"/> + <history type="shallow" id="s0HistShallow"> + <transition target="s02"/> + </history> + <history type="deep" id="s0HistDeep"> + <transition target="s022"/> + </history> + <state id="s01" initial="s011"> + <state id="s011"> + <onentry> + <raise event="entering.s011"/> + </onentry> + </state> + <state id="s012"> + <onentry> + <raise event="entering.s012"/> + </onentry> + </state> + </state> + <state id="s02" initial="s021"> + <state id="s021"> + <onentry> + <raise event="entering.s021"/> + </onentry> + </state> + <state id="s022"> + <onentry> + <raise event="entering.s022"/> + </onentry> + </state> + </state> + </state> + <state id="s1"> + <transition target="s0HistDeep"/> + </state> + <state id="s2"> + <transition target="s0HistShallow"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test396.scxml b/test/w3c/promela/test396.scxml new file mode 100644 index 0000000..745b7cf --- /dev/null +++ b/test/w3c/promela/test396.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the value in _event.name matches the event name used to match against transitions --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="_event.name == 'foo'" target="pass"/> + <transition event="foo" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test399.scxml b/test/w3c/promela/test399.scxml new file mode 100644 index 0000000..5f4548a --- /dev/null +++ b/test/w3c/promela/test399.scxml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the event name matching works correctly, including prefix matching and the fact +that the event attribute of transition may contain multiple event designators. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <!-- this will catch the failure case --> + <transition event="timeout" target="fail"/> + <state id="s01"> + <onentry> + <raise event="foo"/> + </onentry> + <!-- test that an event can match against a transition with multiple descriptors --> + <transition event="foo bar" target="s02"/> + </state> + <state id="s02"> + <onentry> + <raise event="bar"/> + </onentry> + <!-- test that an event can match the second descriptor as well --> + <transition event="foo bar" target="s03"/> + </state> + <state id="s03"> + <onentry> + <raise event="foo.zoo"/> + </onentry> + <!-- test that a prefix descriptor matches --> + <transition event="foo bar" target="s04"/> + </state> + <state id="s04"> + <onentry> + <raise event="foos"/> + </onentry> + <!-- test that only token prefixes match --> + <transition event="foo" target="fail"/> + <transition event="foos" target="s05"/> + </state> + <state id="s05"> + <onentry> + <raise event="foo.zoo"/> + </onentry> + <!-- test that .* works at the end of a descriptor --> + <transition event="foo.*" target="s06"/> + </state> + <state id="s06"> + <onentry> + <raise event="foo"/> + </onentry> + <!-- test that "*" works by itself --> + <transition event="*" target="pass"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test401.scxml b/test/w3c/promela/test401.scxml new file mode 100644 index 0000000..96f3765 --- /dev/null +++ b/test/w3c/promela/test401.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that errors go in the internal event queue. We send ourselves an external event foo, then perform +and operation that raises an error. Then check that the error event is processed first, even though +it was raised second --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="foo"/> + <!-- assigning to a non-existent location should raise an error --> + <assign location="foo.bar.baz " expr="2"/> + </onentry> + <transition event="foo" target="fail"/> + <transition event="error" target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test402.scxml b/test/w3c/promela/test402.scxml new file mode 100644 index 0000000..3888751 --- /dev/null +++ b/test/w3c/promela/test402.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- the assertion that errors are 'like any other event' is pretty broad, but we can check that they +are pulled off the internal queue in order, and that prefix matching works on them. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <!-- catch the failure case --> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <onentry> + <!-- 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="foo.bar.baz " expr="2"/> + </onentry> + <transition event="event1" target="s02"> + <raise event="event2"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s02"> + <transition event="error" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test403a.scxml b/test/w3c/promela/test403a.scxml new file mode 100644 index 0000000..5c8e398 --- /dev/null +++ b/test/w3c/promela/test403a.scxml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test one part of 'optimal enablement' meaning that of all transitions that are enabled, we chose the ones +in child states over parent states, and use document order to break ties. We have +a parent state s0 with two children, s01 and s02. In s01, we test that a) if +a transition in the child matches, we don't consider matches in the parent and b) +that if two transitions match in any state, we take the first in document order. +In s02 we test that we take a transition in the parent if there is no +matching transition in the child. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <!-- catch the failure case --> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="event2" target="pass"/> + <state id="s01"> + <onentry> + <!-- this should be caught by the first transition in this state, taking us to S02 --> + <raise event="event1"/> + </onentry> + <transition event="event1" target="s02"/> + <transition event="*" target="fail"/> + </state> + <state id="s02"> + <onentry> + <!-- since the local transition has a cond that evaluates to false this should be caught by a + transition in the parent state, taking us to pass --> + <raise event="event2"/> + </onentry> + <transition event="event1" target="fail"/> + <transition event="event2" cond="false" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test403b.scxml b/test/w3c/promela/test403b.scxml new file mode 100644 index 0000000..5c28ee2 --- /dev/null +++ b/test/w3c/promela/test403b.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that 'optimally enabled set' really is a set, specifically that if a transition is optimally enabled in +two different states, it is taken only once. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0" initial="p0"> + <!-- this transition should never be taken because a transition in a lower state should + always be selected --> + <transition event="event1"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </transition> + <parallel id="p0"> + <onentry> + <raise event="event1"/> + <raise event="event2"/> + </onentry> + <!-- this transition will be selected by both states p0s1 and p0s2, but should be executed only once --> + <transition event="event1"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </transition> + <state id="p0s1"> + <transition event="event2" cond="Var1==1" target="pass"/> + <transition event="event2" target="fail"/> + </state> + <state id="p0s2"/> + </parallel> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test403c.scxml b/test/w3c/promela/test403c.scxml new file mode 100644 index 0000000..335fc2e --- /dev/null +++ b/test/w3c/promela/test403c.scxml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test 'optimally enabled set', specifically that preemption works correctly --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0" initial="p0"> + <onentry> + <raise event="event1"/> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="event2" target="fail"/> + <transition event="timeout" target="fail"/> + <parallel id="p0"> + <state id="p0s1"> + <transition event="event1"/> + <transition event="event2"/> + </state> + <state id="p0s2"> + <transition event="event1" target="p0s1"> + <raise event="event2"/> + </transition> + </state> + <state id="p0s3"> + <!-- this transition should be blocked by the one in p0s2--> + <transition event="event1" target="fail"/> + <!-- this transition will preempt the one that p0s2 inherits + from an ancestor --> + <transition event="event2" target="s1"/> + </state> + <state id="p0s4"> + <!-- this transition never gets preempted, should fire twice --> + <transition event="*"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </transition> + </state> + </parallel> + </state> + <state id="s1"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test404.scxml b/test/w3c/promela/test404.scxml new file mode 100644 index 0000000..ce61f1e --- /dev/null +++ b/test/w3c/promela/test404.scxml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that states are exited in exit order (children before parents with reverse doc order used to break ties + before the executable content in the transitions. event1, event2, event3, event4 should be raised in that + order when s01p is exited --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01p"> + <parallel id="s01p"> + <onexit> + <!-- this should be the 3rd event raised --> + <raise event="event3"/> + </onexit> + <transition target="s02"> + <!-- this should be the fourth event raised --> + <raise event="event4"/> + </transition> + <state id="s01p1"> + <onexit> + <!-- this should be the second event raised --> + <raise event="event2"/> + </onexit> + </state> + <state id="s01p2"> + <!-- this should be the first event raised --> + <onexit> + <raise event="event1"/> + </onexit> + </state> + </parallel> + <state id="s02"> + <transition event="event1" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event2" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event3" target="s05"/> + <transition event="*" target="fail"/> + </state> + <state id="s05"> + <transition event="event4" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test405.scxml b/test/w3c/promela/test405.scxml new file mode 100644 index 0000000..ce89b3a --- /dev/null +++ b/test/w3c/promela/test405.scxml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the executable content in the transitions is executed in document order after +the states are exited. event1, event2, event3, event4 should be raised in that order when the +state machine is entered --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01p"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <parallel id="s01p"> + <transition event="event1" target="s02"/> + <state id="s01p1" initial="s01p11"> + <state id="s01p11"> + <onexit> + <!-- this should be the second event raised --> + <raise event="event2"/> + </onexit> + <transition target="s01p12"> + <!-- this should be the third event raised --> + <raise event="event3"/> + </transition> + </state> + <state id="s01p12"/> + </state> + <!-- end s01p1 --> + <state id="s01p2" initial="s01p21"> + <state id="s01p21"> + <onexit> + <!-- this should be the first event raised --> + <raise event="event1"/> + </onexit> + <transition target="s01p22"> + <!-- this should be the fourth event raised --> + <raise event="event4"/> + </transition> + </state> + <state id="s01p22"/> + </state> + <!-- end s01p2 --> + </parallel> + <state id="s02"> + <transition event="event2" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event3" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event4" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <!-- end s01 --> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test406.scxml b/test/w3c/promela/test406.scxml new file mode 100644 index 0000000..99c4c40 --- /dev/null +++ b/test/w3c/promela/test406.scxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Test that states are entered in entry order (parents before children with document order used to break ties) +after the executable content in the transition is executed. event1, event2, event3, event4 should be raised in that +order when the transition in s01 is taken --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <transition target="s0p2"> + <!-- this should be the first event raised --> + <raise event="event1"/> + </transition> + </state> + <parallel id="s0p2"> + <transition event="event1" target="s03"/> + <state id="s01p21"> + <onentry> + <!-- third event --> + <raise event="event3"/> + </onentry> + </state> + <state id="s01p22"> + <onentry> + <!-- the fourth event --> + <raise event="event4"/> + </onentry> + </state> + <onentry> + <!-- this should be the second event raised --> + <raise event="event2"/> + </onentry> + </parallel> + <state id="s03"> + <transition event="event2" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event3" target="s05"/> + <transition event="*" target="fail"/> + </state> + <state id="s05"> + <transition event="event4" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <!-- end s0 --> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test407.scxml b/test/w3c/promela/test407.scxml new file mode 100644 index 0000000..9260c05 --- /dev/null +++ b/test/w3c/promela/test407.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a simple test that onexit handlers work. var1 should be incremented when we leave s0 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s0"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + <transition target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test409.scxml b/test/w3c/promela/test409.scxml new file mode 100644 index 0000000..98e3c81 --- /dev/null +++ b/test/w3c/promela/test409.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that states are removed from the active states list as they are exited. When s01's onexit handler +fires, s011 should not be on the active state list, so in(S011) should be false, and event1 should not +be raised. Therefore the timeout should fire to indicate success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delayexpr="'1s'"/> + </onentry> + <transition event="timeout" target="pass"/> + <transition event="event1" target="fail"/> + <state id="s01" initial="s011"> + <onexit> + <if cond="_x.states['s011']"> + <raise event="event1"/> + </if> + </onexit> + <state id="s011"> + <transition target="s02"/> + </state> + </state> + <!-- end s01 --> + <state id="s02"/> + </state> + <!-- end s0 --> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test411.scxml b/test/w3c/promela/test411.scxml new file mode 100644 index 0000000..aae7e3c --- /dev/null +++ b/test/w3c/promela/test411.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that states are added to the active states list as they are entered and before onentry handlers +are executed. When s0's onentry handler fires we should not be in s01. But when s01's onentry handler +fires, we should be in s01. Therefore event1 should not fire, but event2 should. Either event1 or +timeout also indicates failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + <if cond="_x.states['s01']"> + <raise event="event1"/> + </if> + </onentry> + <transition event="timeout" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="event2" target="pass"/> + <state id="s01"> + <onentry> + <if cond="_x.states['s01']"> + <raise event="event2"/> + </if> + </onentry> + </state> + </state> + <!-- end s0 --> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test412.scxml b/test/w3c/promela/test412.scxml new file mode 100644 index 0000000..cc362be --- /dev/null +++ b/test/w3c/promela/test412.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that executable content in the <initial> transition executes after the onentry handler on the state +and before the onentry handler of the child states. Event1, event2, and event3 should occur in that order. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="event2" target="pass"/> + <state id="s01"> + <onentry> + <raise event="event1"/> + </onentry> + <initial> + <transition target="s011"> + <raise event="event2"/> + </transition> + </initial> + <state id="s011"> + <onentry> + <raise event="event3"/> + </onentry> + <transition target="s02"/> + </state> + </state> + <state id="s02"> + <transition event="event1" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event2" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event3" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <!-- end s0 --> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test413.scxml b/test/w3c/promela/test413.scxml new file mode 100644 index 0000000..2efec12 --- /dev/null +++ b/test/w3c/promela/test413.scxml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the state machine is put into the configuration specified by the initial element, without regard +to any other defaults. we should start off in s2p111 and s2p122. the atomic +states we should not enter all have immediate transitions to failure in them --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s2p112 s2p122" version="1.0" datamodel="promela"> + <state id="s1"> + <transition target="fail"/> + </state> + <state id="s2" initial="s2p1"> + <parallel id="s2p1"> + <!-- this transition will be triggered only if we end up in an illegal configuration where we're in + either s2p112 or s2p122, but not both of them --> + <transition target="fail"/> + <state id="s2p11" initial="s2p111"> + <state id="s2p111"> + <transition target="fail"/> + </state> + <state id="s2p112"> + <transition cond="_x.states['s2p122']" target="pass"/> + </state> + </state> + <!-- end s2p11 --> + <state id="s2p12" initial="s2p121"> + <state id="s2p121"> + <transition target="fail"/> + </state> + <state id="s2p122"> + <transition cond="_x.states['s2p112']" target="pass"/> + </state> + </state> + </parallel> + </state> + <!-- end s2 --> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test415.scxml b/test/w3c/promela/test415.scxml new file mode 100644 index 0000000..64d0c18 --- /dev/null +++ b/test/w3c/promela/test415.scxml @@ -0,0 +1,13 @@ +<?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="promela"> + <final id="final"> + <onentry> + <raise event="event1"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test416.scxml b/test/w3c/promela/test416.scxml new file mode 100644 index 0000000..763a48a --- /dev/null +++ b/test/w3c/promela/test416.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the done.state.id gets generated when we enter the final state of a compound state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="promela"> + <state id="s1" initial="s11"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s11" initial="s111"> + <transition event="done.state.s11" target="pass"/> + <state id="s111"> + <transition target="s11final"/> + </state> + <final id="s11final"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test417.scxml b/test/w3c/promela/test417.scxml new file mode 100644 index 0000000..abe4aa1 --- /dev/null +++ b/test/w3c/promela/test417.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we get the done.state.id event when all of a +parallel elements children enter final states. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="promela"> + <state id="s1" initial="s1p1"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <parallel id="s1p1"> + <transition event="done.state.s1p1" target="pass"/> + <state id="s1p11" initial="s1p111"> + <state id="s1p111"> + <transition target="s1p11final"/> + </state> + <final id="s1p11final"/> + </state> + <state id="s1p12" initial="s1p121"> + <state id="s1p121"> + <transition target="s1p12final"/> + </state> + <final id="s1p12final"/> + </state> + </parallel> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test419.scxml b/test/w3c/promela/test419.scxml new file mode 100644 index 0000000..1a26d2f --- /dev/null +++ b/test/w3c/promela/test419.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that eventless transitions take precedence over event-driven ones --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="promela"> + <state id="s1"> + <onentry> + <raise event="internalEvent"/> + <send event="externalEvent"/> + </onentry> + <transition event="*" target="fail"/> + <transition target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test421.scxml b/test/w3c/promela/test421.scxml new file mode 100644 index 0000000..09483d2 --- /dev/null +++ b/test/w3c/promela/test421.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that internal events take priority over external ones, and that the processor +keeps pulling off internal events until it finds one that triggers a transition --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="promela"> + <state id="s1" initial="s11"> + <onentry> + <send event="externalEvent"/> + <raise event="internalEvent1"/> + <raise event="internalEvent2"/> + <raise event="internalEvent3"/> + <raise event="internalEvent4"/> + </onentry> + <transition event="externalEvent" target="fail"/> + <state id="s11"> + <transition event="internalEvent3" target="s12"/> + </state> + <state id="s12"> + <transition event="internalEvent4" target="pass"/> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test422.scxml b/test/w3c/promela/test422.scxml new file mode 100644 index 0000000..bc99d52 --- /dev/null +++ b/test/w3c/promela/test422.scxml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Test that at the end of a macrostep, the processor executes all invokes in states +that have been entered and not exited during the step. (The invokes are supposed to be executed +in document order, but we can test that since each invocation is separate and they may take +different amounts to time to start up.) In this case, there are three invoke statements, +in states s1, s11 and s12. Each invoked process returns an event named after its parent state. +The invokes in s1 and s12 should execute, but not the one +in s11. So we should receive invokeS1, invokeS12, but not invokeS12. Furthermore, when the timeout fires, var1 should equal 2.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <state id="s1" initial="s11"> + <onentry> + <send event="timeout" delayexpr="'2s'"/> + </onentry> + <transition event="invokeS1 invokeS12"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </transition> + <transition event="invokeS11" target="fail"/> + <transition event="timeout" cond="Var1==2" target="pass"/> + <transition event="timeout" target="fail"/> + <invoke> + <content> + <!-- when invoked, send 'foo' to parent, then terminate. --> + <scxml initial="sub0" version="1.0" datamodel="promela"> + <state id="sub0"> + <onentry> + <send target="#_parent" event="invokeS1"/> + </onentry> + <transition target="subFinal0"/> + </state> + <final id="subFinal0"/> + </scxml> + </content> + </invoke> + <state id="s11"> + <invoke> + <content> + <!-- when invoked, send 'foo' to parent, then terminate. --> + <scxml initial="sub1" version="1.0" datamodel="promela"> + <state id="sub1"> + <onentry> + <send target="#_parent" event="invokeS11"/> + </onentry> + <transition target="subFinal1"/> + </state> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <transition target="s12"/> + </state> + <state id="s12"> + <invoke> + <content> + <!-- when invoked, send 'foo' to parent, then terminate. --> + <scxml initial="sub2" version="1.0" datamodel="promela"> + <state id="sub2"> + <onentry> + <send target="#_parent" event="invokeS12"/> + </onentry> + <transition target="subFinal2"/> + </state> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test423.scxml b/test/w3c/promela/test423.scxml new file mode 100644 index 0000000..6d87d30 --- /dev/null +++ b/test/w3c/promela/test423.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we keep pulling external events off the queue till we find one that matches a transition. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="externalEvent1"/> + <send event="externalEvent2" delayexpr="'1s'"/> + <raise event="internalEvent"/> + </onentry> + <!-- in this state we should process only internalEvent --> + <transition event="internalEvent" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <!-- in this state we ignore externalEvent1 and wait for externalEvent2 --> + <transition event="externalEvent2" target="pass"/> + <transition event="internalEvent" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test436.scxml b/test/w3c/promela/test436.scxml new file mode 100644 index 0000000..413b9ec --- /dev/null +++ b/test/w3c/promela/test436.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that in() predicate works in null data model --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="null" version="1.0" initial="p"> + <parallel id="p"> + <state id="ps0"> + <transition cond="_x.states['s1']" target="fail"/> + <transition cond="_x.states['ps1']" target="pass"/> + <transition target="fail"/> + </state> + <state id="ps1"/> + </parallel> + <state id="s1"/> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test446.txt b/test/w3c/promela/test446.txt new file mode 100644 index 0000000..3a26a2e --- /dev/null +++ b/test/w3c/promela/test446.txt @@ -0,0 +1 @@ +[1,2,3]
\ No newline at end of file diff --git a/test/w3c/promela/test487.scxml b/test/w3c/promela/test487.scxml new file mode 100644 index 0000000..3b81768 --- /dev/null +++ b/test/w3c/promela/test487.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test illegal assignment. error.execution should be raised. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="event"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test488.scxml b/test/w3c/promela/test488.scxml new file mode 100644 index 0000000..78154b4 --- /dev/null +++ b/test/w3c/promela/test488.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that illegal expr in <param> produces error.execution and empty event.data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0" initial="s01"> + <!-- we should get the error before the done event --> + <transition event="error.execution" target="s1"/> + <transition event="done.state.s0" target="fail"/> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param expr="return" name="someParam"/> + </donedata> + </final> + </state> + <!-- if we get here, we received the error event. Now check that the done + event has empty event.data --> + <state id="s1"> + <transition event="done.state.s0" cond="!(_event.data)" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test495.scxml b/test/w3c/promela/test495.scxml new file mode 100644 index 0000000..2c07a91 --- /dev/null +++ b/test/w3c/promela/test495.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the scxml event i/o processor puts events in the correct queues.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <!-- default target is external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="event2" target="#_internal" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + </onentry> + <!-- we should get the internal event first --> + <transition event="event1" target="fail"/> + <transition event="event2" target="s1"/> + </state> + <state id="s1"> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test496.scxml b/test/w3c/promela/test496.scxml new file mode 100644 index 0000000..c3babeb --- /dev/null +++ b/test/w3c/promela/test496.scxml @@ -0,0 +1,21 @@ +<?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="promela"> + <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 xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test500.scxml b/test/w3c/promela/test500.scxml new file mode 100644 index 0000000..0b046d0 --- /dev/null +++ b/test/w3c/promela/test500.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that location field is found inside entry for SCXML Event I/O processor --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="_ioprocessors.scxml.location"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test501.scxml b/test/w3c/promela/test501.scxml new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/test/w3c/promela/test501.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the location entry for the SCXML Event I/O processor can be used as the target for 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="promela"> + <datamodel> + <data id="Var1" type="int" expr="_ioprocessors.scxml.location"/> + </datamodel> + <state id="s0"> + <onentry> + <send targetexpr="Var1" event="foo"/> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="foo" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test503.scxml b/test/w3c/promela/test503.scxml new file mode 100644 index 0000000..5914d69 --- /dev/null +++ b/test/w3c/promela/test503.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a targetless transition does not exit and reenter its source state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <!-- how often we have exited s2 --> + <data id="Var2" type="int" expr="0"/> + <!-- how often the targetless transition in s2 has been executed --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="s2"/> + </state> + <state id="s2"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var2" expr="Var2 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var2==1" target="s3"/> + <transition event="bar" target="fail"/> + </state> + <state id="s3"> + <!-- make sure that s2 was exited only once --> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test504.scxml b/test/w3c/promela/test504.scxml new file mode 100644 index 0000000..0aa69b4 --- /dev/null +++ b/test/w3c/promela/test504.scxml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an external transition exits all states up the the LCCA --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <!-- how often we have exited p --> + <data id="Var2" type="int" expr="0"/> + <!-- how often we have exited ps1 --> + <data id="Var3" type="int" expr="0"/> + <!-- how often we have exited ps2 --> + <data id="Var4" type="int" expr="0"/> + <!-- how often the transition for foo has been taken --> + <data id="Var5" type="int" expr="0"/> + <!-- how often we have exited s2 --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="p"/> + </state> + <state id="s2"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var5" expr="Var5 + 1"/> + </onexit> + <parallel id="p"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" target="ps1"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var4" expr="Var4 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var4==1" target="s3"/> + <transition event="bar" target="fail"/> + <state id="ps1"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + <state id="ps2"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var3" expr="Var3 + 1"/> + </onexit> + </state> + </parallel> + </state> + <state id="s3"> + <!-- make sure that p was exited twice --> + <transition cond="Var1==2" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <!-- make sure that ps1 was exited twice --> + <transition cond="Var2==2" target="s5"/> + <transition target="fail"/> + </state> + <state id="s5"> + <!-- make sure that ps2 was exited twice --> + <transition cond="Var3==2" target="s6"/> + <transition target="fail"/> + </state> + <state id="s6"> + <!-- make sure that s1 was exited once --> + <transition cond="Var5==1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test505.scxml b/test/w3c/promela/test505.scxml new file mode 100644 index 0000000..02e18b0 --- /dev/null +++ b/test/w3c/promela/test505.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an internal transition does not exit its source state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <!-- how often we have exited s1 --> + <data id="Var2" type="int" expr="0"/> + <!-- how often we have exited s11 --> + <data id="Var3" type="int" expr="0"/> + <!-- how often the transition for foo has been taken --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" type="internal" target="s11"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var3" expr="Var3 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var3==1" target="s2"/> + <transition event="bar" target="fail"/> + <state id="s11"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + </state> + <state id="s2"> + <!-- make sure that s1 was exited once --> + <transition cond="Var1==1" target="s3"/> + <transition target="fail"/> + </state> + <state id="s3"> + <!-- make sure that s11 was exited twice --> + <transition cond="Var2==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test506.scxml b/test/w3c/promela/test506.scxml new file mode 100644 index 0000000..83b05b9 --- /dev/null +++ b/test/w3c/promela/test506.scxml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an internal transition whose targets are not proper descendants of its source state +behaves like an external transition --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <!-- how often we have exited s2 --> + <data id="Var2" type="int" expr="0"/> + <!-- how often we have exited s21 --> + <data id="Var3" type="int" expr="0"/> + <!-- how often the transition for foo has been taken --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="s2"/> + </state> + <state id="s2" initial="s21"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" type="internal" target="s2"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var3" expr="Var3 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var3==1" target="s3"/> + <transition event="bar" target="fail"/> + <state id="s21"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + </state> + <state id="s3"> + <!-- make sure that s2 was exited twice --> + <transition cond="Var1==2" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <!-- make sure that s21 was exited twice --> + <transition cond="Var2==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test509.scxml b/test/w3c/promela/test509.scxml new file mode 100644 index 0000000..4b7f540 --- /dev/null +++ b/test/w3c/promela/test509.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that Basic HTTP Event I/O processor uses POST method and that it can receive messages +at the accessURI --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </onentry> + <!-- if the event was send by http and we get it, we succeed --> + <transition event="test" cond="_event.raw.search('POST') !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test510.scxml b/test/w3c/promela/test510.scxml new file mode 100644 index 0000000..fbb2f25 --- /dev/null +++ b/test/w3c/promela/test510.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that Basic HTTP messages go into external queue. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + <!-- this creates an internal event --> + <raise event="internal"/> + </onentry> + <!-- we should get 'internal' first, then 'test' --> + <transition event="internal" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="test" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test513.txt b/test/w3c/promela/test513.txt new file mode 100644 index 0000000..08e9b01 --- /dev/null +++ b/test/w3c/promela/test513.txt @@ -0,0 +1,16 @@ +This is a fully manual test. You send a well formed event to the 'location' URL + specified for your SCXML interpreter and check that you get a 200 response code back. + One way of doing this, using wget, is shown below (you can use any event name you + want, but you must use '_scxmleventname' to indicate the name of the event): + +$ wget \ +--post-data='key1=value1&key2=value2' \ +--header '_scxmleventname: test' \ +<!-- URL of your processor goes here --> + +--2014-06-25 17:54:49-- http://epikur.local:8090/925c760f-2093-4054-a24c-d972d75f0dcd/basichttp +Resolving epikur.local (epikur.local)... 10.211.55.2, 10.37.129.2, 10.0.1.54, ... +Connecting to epikur.local (epikur.local)|10.211.55.2|:8090... connected. +HTTP request sent, awaiting response... 200 OK +Length: 0 [text/html] +Saving to: ‘basichttp’
\ No newline at end of file diff --git a/test/w3c/promela/test518.scxml b/test/w3c/promela/test518.scxml new file mode 100644 index 0000000..d6f88d3 --- /dev/null +++ b/test/w3c/promela/test518.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that namelist values get encoded as POST parameters. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="2"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors.basichttp.location" namelist="Var1" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </onentry> + <transition event="test" cond="_event.raw.search(/Var1=2/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test519.scxml b/test/w3c/promela/test519.scxml new file mode 100644 index 0000000..f3645c0 --- /dev/null +++ b/test/w3c/promela/test519.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that <param> values get encoded as POST parameters. . --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="param1" expr="1"/> + </send> + </onentry> + <!-- if other end sends us back this event, we succeed --> + <transition event="test" cond="_event.raw.search('param1=1') !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test520.scxml b/test/w3c/promela/test520.scxml new file mode 100644 index 0000000..f25f8d3 --- /dev/null +++ b/test/w3c/promela/test520.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that <content> gets sent as the body of the message. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <content>this is some content</content> + </send> + </onentry> + <!-- if other end sends us back this event, we succeed. Test for two common + ways of encoding --> + <transition event="HTTP.POST" cond="_event.raw.search(/this+is+some+content/) !== -1" target="pass"/> + <transition event="HTTP.POST" cond="_event.raw.search(/this%20is%20some%20content/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test521.scxml b/test/w3c/promela/test521.scxml new file mode 100644 index 0000000..f5e5859 --- /dev/null +++ b/test/w3c/promela/test521.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor raises error.communication if it cannot dispatch the event. +(To create an undispatchable event, we choose a non-existent session as target). If it raises +the error event, we succeed. Otherwise we eventually timeout and fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <!-- should cause an error --> + <send target="#_scxml_foo" event="event2"/> + <!-- this will get added to the external event queue after the error has been raised --> + <send event="timeout"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="error.communication" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test522.scxml b/test/w3c/promela/test522.scxml new file mode 100644 index 0000000..e31c289 --- /dev/null +++ b/test/w3c/promela/test522.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that location field the entry for Basic HTTP Event I/O processor can be used +to send a message to the processor --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" targetexpr="_ioprocessors.basichttp.location"/> + </onentry> + <!-- the event we receive should be called 'test', but that's not actually + required for this test. Only that the send deliver some event to us. So if + we get something other than timeout or error, we call it success --> + <transition event="timeout" target="fail"/> + <transition event="error" target="fail"/> + <transition event="*" target="pass"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test525.scxml b/test/w3c/promela/test525.scxml new file mode 100644 index 0000000..5df4afa --- /dev/null +++ b/test/w3c/promela/test525.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that <foreach> does a shallow copy, so that modifying the array does not change +the iteration behavior. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int[3]"> + + Var1[0] = 1; + Var1[1] = 2; + Var1[2] = 3; + + </data> + <data id="Var2" type="int" expr="0"/> + <!-- counts the number of iterations --> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var3" array="Var1"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="[].concat(Var1, [4])"/> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var2" expr="Var2 + 1"/> + </foreach> + </onentry> + <transition cond="Var2==3" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test527.scxml b/test/w3c/promela/test527.scxml new file mode 100644 index 0000000..337c027 --- /dev/null +++ b/test/w3c/promela/test527.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- simple test that 'expr' works with <content> --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0" initial="s01"> + <transition event="done.state.s0" cond="_event.data == 'foo'" target="pass"> + </transition> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <content expr="'foo'"/> + </donedata> + </final> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test528.scxml b/test/w3c/promela/test528.scxml new file mode 100644 index 0000000..8b79479 --- /dev/null +++ b/test/w3c/promela/test528.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that illegal 'expr' produces error.execution and empty event.data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0" initial="s01"> + <!-- we should get the error before the done event --> + <transition event="error.execution" target="s1"/> + <transition event="done.state.s0" target="fail"/> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <content expr="return"/> + </donedata> + </final> + </state> + <!-- if we get here, we received the error event. Now check that the done + event has empty event.data --> + <state id="s1"> + <transition event="done.state.s0" cond="!(_event.data)" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test529.scxml b/test/w3c/promela/test529.scxml new file mode 100644 index 0000000..4d5347c --- /dev/null +++ b/test/w3c/promela/test529.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- simple test that children workn with <content> --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="s0"> + <state id="s0" initial="s01"> + <transition event="done.state.s0" cond="_event.data == 21" target="pass"> + </transition> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <content>21</content> + </donedata> + </final> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test530.scxml b/test/w3c/promela/test530.scxml new file mode 100644 index 0000000..c23eb9a --- /dev/null +++ b/test/w3c/promela/test530.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that <content> child is evaluated when <invoke> is. Var1 is initialized +with an integer value, then set to an scxml script in the onentry to s0. If <content> +is evaluated at the right time, we should get invoke.done, otherwise an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1"> + <scxml version="1.0"> + <final/> + </scxml> + </assign> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content expr="Var1"/> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test531.scxml b/test/w3c/promela/test531.scxml new file mode 100644 index 0000000..1e8cd15 --- /dev/null +++ b/test/w3c/promela/test531.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that the value of the <param> _scxmleventname gets used as the name +of the raised event. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <send targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="_scxmleventname" expr="'test'"/> + </send> + </onentry> + <!-- if we get an event named 'test' we succeed. Otherwise fail --> + <transition event="test" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test532.scxml b/test/w3c/promela/test532.scxml new file mode 100644 index 0000000..69ffa54 --- /dev/null +++ b/test/w3c/promela/test532.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that if _scxmleventname is not present, the name of the HTTP method is used +as the name of the resulting event. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <send targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <!-- this content will be ignored, but it's here to make sure we have a message body --> + <content>some content</content> + </send> + </onentry> + <transition event="HTTP.POST" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test533.scxml b/test/w3c/promela/test533.scxml new file mode 100644 index 0000000..68d9406 --- /dev/null +++ b/test/w3c/promela/test533.scxml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an internal transition whose source state is not compound does exit its source state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + <!-- how often we have exited p --> + <data id="Var2" type="int" expr="0"/> + <!-- how often we have exited ps1 --> + <data id="Var3" type="int" expr="0"/> + <!-- how often we have exited ps2 --> + <data id="Var4" type="int" expr="0"/> + <!-- how often the transition for foo has been taken --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="p"/> + </state> + <parallel id="p"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" type="internal" target="ps1"> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var4" expr="Var4 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var4==1" target="s2"/> + <transition event="bar" target="fail"/> + <state id="ps1"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + <state id="ps2"> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var3" expr="Var3 + 1"/> + </onexit> + </state> + </parallel> + <state id="s2"> + <!-- make sure that p was exited twice --> + <transition cond="Var1==2" target="s3"/> + <transition target="fail"/> + </state> + <state id="s3"> + <!-- make sure that ps1 was exited twice --> + <transition cond="Var2==2" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <!-- make sure that ps2 was exited twice --> + <transition cond="Var3==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test534.scxml b/test/w3c/promela/test534.scxml new file mode 100644 index 0000000..65b03e4 --- /dev/null +++ b/test/w3c/promela/test534.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that <send> 'event' value gets sent as the param _scxmleventname . --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + </send> + </onentry> + <!-- if other end sends us back this event, we succeed --> + <transition event="test" cond="_event.raw.search('_scxmleventname=test') !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test539.txt b/test/w3c/promela/test539.txt new file mode 100644 index 0000000..de1b0a1 --- /dev/null +++ b/test/w3c/promela/test539.txt @@ -0,0 +1,4 @@ + <books xmlns=""> + <book title="title1"/> + <book title="title2"/> + </books>
\ No newline at end of file diff --git a/test/w3c/promela/test540.txt b/test/w3c/promela/test540.txt new file mode 100644 index 0000000..2191239 --- /dev/null +++ b/test/w3c/promela/test540.txt @@ -0,0 +1,3 @@ +123 +4 5 +
\ No newline at end of file diff --git a/test/w3c/promela/test550.scxml b/test/w3c/promela/test550.scxml new file mode 100644 index 0000000..fc00d05 --- /dev/null +++ b/test/w3c/promela/test550.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that expr can be used to assign a value to a var. This test uses early binding --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela" binding="early"> + <state id="s0"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" type="int" expr="2"/> + </datamodel> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test551.scxml b/test/w3c/promela/test551.scxml new file mode 100644 index 0000000..7fca0b4 --- /dev/null +++ b/test/w3c/promela/test551.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that inline content can be used to assign a value to a var. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" binding="early" datamodel="promela"> + + + <state id="s0"> + + <transition cond="Var1[1]" target="pass"/> + <transition target="fail"/> + </state> + +<state id="s1"> + <datamodel> + <data id="Var1" type="int[3]"> + + Var1[0] = 1; + Var1[1] = 2; + Var1[2] = 3; + + </data> + </datamodel> + </state> + + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + + + +</scxml>
\ No newline at end of file diff --git a/test/w3c/promela/test552.scxml b/test/w3c/promela/test552.scxml new file mode 100644 index 0000000..320b42d --- /dev/null +++ b/test/w3c/promela/test552.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that src content can be used to assign a value to a var. Edit +test552.txt to have a value that's legal for the datamodel in question --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <datamodel> + <data id="Var1" type="int" src="file:test552.txt"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test552.txt b/test/w3c/promela/test552.txt new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/test/w3c/promela/test552.txt @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/test/w3c/promela/test553.scxml b/test/w3c/promela/test553.scxml new file mode 100644 index 0000000..ad056a8 --- /dev/null +++ b/test/w3c/promela/test553.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor does not dispatch the event if evaluation +of <send>'s args causes an error.. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <state id="s0"> + <onentry> + <!-- timeout event --> + <send event="timeout" delayexpr="'1s'"/> + <!-- generate an invalid namelist --> + <send event="event1" namelist=""foo"/> + </onentry> + <!-- if we get the timeout before event1, we assume that event1 hasn't been sent + We ignore the error event here because this assertion doesn't mention it --> + <transition event="timeout" target="pass"/> + <transition event="event1" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test554.scxml b/test/w3c/promela/test554.scxml new file mode 100644 index 0000000..b93888a --- /dev/null +++ b/test/w3c/promela/test554.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that if the evaluation of <invoke>'s args causes an error, the +invocation is cancelled. In this test, that means that we don't get done.invoke +before the timer goes off. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="promela"> + <state id="s0"> + <onentry> + <send event="timer" delayexpr="'1s'"/> + </onentry> + <!-- reference an invalid namelist --> + <invoke type="http://www.w3.org/TR/scxml/" namelist=""foo"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="promela"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timer" target="pass"/> + <transition event="done.invoke" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test557.txt b/test/w3c/promela/test557.txt new file mode 100644 index 0000000..a8e51da --- /dev/null +++ b/test/w3c/promela/test557.txt @@ -0,0 +1,4 @@ +<books xmlns=""> + <book title="title1"/> + <book title="title2"/> + </books>
\ No newline at end of file diff --git a/test/w3c/promela/test558.txt b/test/w3c/promela/test558.txt new file mode 100644 index 0000000..bb2bcc7 --- /dev/null +++ b/test/w3c/promela/test558.txt @@ -0,0 +1,3 @@ + +this is +a string
\ No newline at end of file diff --git a/test/w3c/promela/test567.scxml b/test/w3c/promela/test567.scxml new file mode 100644 index 0000000..50eb4bd --- /dev/null +++ b/test/w3c/promela/test567.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that any content in the message other than _scxmleventname is used to populate +_event.data. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="2"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <!-- in this case, 'test' will be placed in _scxmleventname. The <param> should + be used to populate _event.data --> + <send event="test" targetexpr="_ioprocessors.basichttp.location" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="param1" expr="2"/> + </send> + </onentry> + <!-- if we get this event, we succeed --> + <transition event="test" target="s1"> + <assign location="Var1" expr="_event.data.param1"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test570.scxml b/test/w3c/promela/test570.scxml new file mode 100644 index 0000000..6ec678b --- /dev/null +++ b/test/w3c/promela/test570.scxml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we generate done.state.id when all a parallel state's children are in final states --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="p0" datamodel="promela" version="1.0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <parallel id="p0"> + <onentry> + <send event="timeout" delay="2s"/> + <raise event="e1"/> + <raise event="e2"/> + </onentry> + <!-- record that we get the first done event --> + <transition event="done.state.p0s1"> + <assign location="Var1" expr="1"/> + </transition> + <!-- we should get the second done event before done.state.p0 --> + <transition event="done.state.p0s2" target="s1"/> + <transition event="timeout" target="fail"/> + <state id="p0s1" initial="p0s11"> + <state id="p0s11"> + <transition event="e1" target="p0s1final"/> + </state> + <final id="p0s1final"/> + </state> + <state id="p0s2" initial="p0s21"> + <state id="p0s21"> + <transition event="e2" target="p0s2final"/> + </state> + <final id="p0s2final"/> + </state> + </parallel> + <state id="s1"> + <!-- if we get done.state.p0, success --> + <transition event="done.state.p0" cond="Var1==1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test576.scxml b/test/w3c/promela/test576.scxml new file mode 100644 index 0000000..1b40fd7 --- /dev/null +++ b/test/w3c/promela/test576.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the 'initial' value of scxml is respected. We set the value to deeply nested non-default parallel siblings and +test that both are entered. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s11p112 s11p122" datamodel="promela" version="1.0"> + <state id="s0"> + <transition target="fail"/> + </state> + <state id="s1"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s11" initial="s111"> + <state id="s111"/> + <parallel id="s11p1"> + <state id="s11p11" initial="s11p111"> + <state id="s11p111"/> + <state id="s11p112"> + <onentry> + <raise event="In-s11p112"/> + </onentry> + </state> + </state> + <state id="s11p12" initial="s11p121"> + <state id="s11p121"/> + <state id="s11p122"> + <transition event="In-s11p112" target="pass"/> + </state> + </state> + </parallel> + </state> + </state> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test577.scxml b/test/w3c/promela/test577.scxml new file mode 100644 index 0000000..b5922ca --- /dev/null +++ b/test/w3c/promela/test577.scxml @@ -0,0 +1,25 @@ +<?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="promela" 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 xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test579.scxml b/test/w3c/promela/test579.scxml new file mode 100644 index 0000000..20419d8 --- /dev/null +++ b/test/w3c/promela/test579.scxml @@ -0,0 +1,60 @@ +<?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="promela"> + <state id="s0"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <initial> + <transition target="sh1"> + <raise event="event2"/> + </transition> + </initial> + <onentry> + <send delayexpr="'1s'" event="timeout"/> + <raise event="event1"/> + </onentry> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" 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 xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/promela/test580.scxml b/test/w3c/promela/test580.scxml new file mode 100644 index 0000000..ac1cbb7 --- /dev/null +++ b/test/w3c/promela/test580.scxml @@ -0,0 +1,45 @@ +<?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="promela"> + <datamodel> + <data id="Var1" type="int" expr="0"/> + </datamodel> + <parallel id="p1"> + <onentry> + <send delay="2s" event="timeout"/> + </onentry> + <state id="s0"> + <transition cond="_x.states['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="_x.states['sh1']" target="fail"/> + <transition target="s12"/> + </state> + <state id="s12"/> + <transition cond="_x.states['sh1']" target="fail"/> + <transition cond="Var1==0" target="sh1"/> + <transition cond="Var1==1" target="pass"/> + <onexit> + <assign xmlns:scxml="http://www.w3.org/2005/07/scxml" location="Var1" expr="Var1 + 1"/> + </onexit> + </state> + </parallel> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/run_promela_test.cmake b/test/w3c/run_promela_test.cmake new file mode 100644 index 0000000..e46ab60 --- /dev/null +++ b/test/w3c/run_promela_test.cmake @@ -0,0 +1,23 @@ +# convert given file to promela and run spin + +get_filename_component(TEST_FILE_NAME ${TESTFILE} NAME) + +execute_process(COMMAND ${USCXML_TRANSFORM_BIN} -s -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.pml RESULT_VARIABLE CMD_RESULT) +if(CMD_RESULT) + message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}") +endif() + +execute_process(COMMAND ${SPIN_BIN} -a ${OUTDIR}/${TEST_FILE_NAME}.pml RESULT_VARIABLE CMD_RESULT) +if(CMD_RESULT) + message(FATAL_ERROR "Error running ${SPIN_BIN}: ${CMD_RESULT}") +endif() + +execute_process(COMMAND ${GCC_BIN} -DMEMLIM=1024 -O2 -DXUSAFE -w -o ${OUTDIR}/pan ${OUTDIR}/pan.c RESULT_VARIABLE CMD_RESULT) +if(CMD_RESULT) + message(FATAL_ERROR "Error running ${GCC_BIN}: ${CMD_RESULT}") +endif() + +execute_process(COMMAND ${OUTDIR}/pan -m10000 -a RESULT_VARIABLE CMD_RESULT) +if(CMD_RESULT) + message(FATAL_ERROR "Error running pan: ${CMD_RESULT}") +endif() diff --git a/test/w3c/txml/test307.txml b/test/w3c/txml/test307.txml index 4065f5f..0cfeef2 100644 --- a/test/w3c/txml/test307.txml +++ b/test/w3c/txml/test307.txml @@ -1,5 +1,5 @@ <?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" version="1.0" initial="s0" binding="late"> +xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" conf:datamodel="" binding="late"> <!-- with binding=late, in s0 we access a variable that isn't created until we get to s1. Then in s1 we access a non-existent substructure of a variable. We use log tags to report the values that both operations |