summaryrefslogtreecommitdiffstats
path: root/test/src/test-issue-reporting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/test-issue-reporting.cpp')
-rw-r--r--test/src/test-issue-reporting.cpp886
1 files changed, 443 insertions, 443 deletions
diff --git a/test/src/test-issue-reporting.cpp b/test/src/test-issue-reporting.cpp
index 9750c58..84cc096 100644
--- a/test/src/test-issue-reporting.cpp
+++ b/test/src/test-issue-reporting.cpp
@@ -7,11 +7,11 @@ using namespace uscxml;
std::set<std::string> issueLocationsForXML(const std::string xml) {
Interpreter interpreter = Interpreter::fromXML(xml, "");
- // common xmlns and version requirement on scxml attribute
- interpreter.getDocument().getDocumentElement().setAttribute("xmlns", "http://www.w3.org/2005/07/scxml");
- interpreter.getDocument().getDocumentElement().setAttribute("version", "1.0");
+ // common xmlns and version requirement on scxml attribute
+ interpreter.getDocument().getDocumentElement().setAttribute("xmlns", "http://www.w3.org/2005/07/scxml");
+ interpreter.getDocument().getDocumentElement().setAttribute("version", "1.0");
- std::list<InterpreterIssue> issues = interpreter.validate();
+ std::list<InterpreterIssue> issues = interpreter.validate();
std::set<std::string> issueLocations;
@@ -101,7 +101,7 @@ int main(int argc, char** argv) {
if (0) {
// State has no 'id' attribute
- // *** This is not actually an error! ***
+ // *** This is not actually an error! ***
const char* xml =
"<scxml datamodel=\"ecmascript\">"
" <state>"
@@ -142,250 +142,250 @@ int main(int argc, char** argv) {
assert(issueLocations.size() == 1);
}
- if (1) {
- // Useless history 1
-
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"bar\">"
- " <history id=\"bar\" />"
- " <state id=\"baz\" />"
- " <transition event=\"e.foo\" target=\"done\" />"
- " <transition event=\"e.bar\" target=\"baz\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//history[@id=\"bar\"]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // Useless history 2
-
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"bar\">"
- " <history id=\"bar\">"
- " <transition target=\"foo\" />"
- " </history>"
- " <transition target=\"done\" />"
- " <state id=\"foo\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//history[@id=\"bar\"]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // No legal completion
-
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"foo bar\">"
- " <state id=\"foo\" />"
- " <state id=\"bar\" />"
- " <transition target=\"foo bar\" />"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
- assert(issueLocations.find("//state[@id=\"start\"]/transition[1]") != issueLocations.end());
- assert(issueLocations.size() == 2);
- }
-
- if (1) {
- // attribute constraints
-
- {
- // initial attribute and <initial> child
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"foo\">"
- " <initial>"
- " <transition target=\"foo\" />"
- " </initial>"
- " <state id=\"foo\" />"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- {
- // initial attribute with atomic state
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- {
- // initial child with atomic state
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <initial>"
- " <transition target=\"start\" />"
- " </initial>"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
- assert(issueLocations.size() == 2); // also invalid non-child target state in initial
- }
-
- // combinations of namelist, content and param
- {
- // send with content and namelist, not allowed
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <onentry>"
- " <send target=\"#_external\" namelist=\"var1\">"
- " <content>Foo!</content>"
- " </send>"
- " </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);
- }
-
- {
- // send with content and params, not allowed
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <onentry>"
- " <send target=\"#_external\">"
- " <param name=\"foo\" expr=\"3\" />"
- " <content>Foo!</content>"
- " </send>"
- " </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);
- }
-
- {
- // send with params and namelist, perfectly acceptable
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <onentry>"
- " <send target=\"#_external\" namelist=\"foo\">"
- " <param name=\"foo\" expr=\"3\" />"
- " </send>"
- " </onentry>"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.size() == 0);
- }
-
- {
- // invoke with content and src, not allowed
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <invoke type=\"scxml\" src=\"var1\">"
- " <content>Foo!</content>"
- " </invoke>"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/invoke[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- {
- // invoke with namelist and param, not allowed
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <invoke type=\"scxml\" namelist=\"var1\">"
- " <param name=\"foo\" expr=\"3\" />"
- " </invoke>"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/invoke[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- {
- // invoke with param and content, perfectly acceptable
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <invoke type=\"scxml\">"
- " <param name=\"foo\" expr=\"3\" />"
- " <content>Foo!</content>"
- " </invoke>"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.size() == 0);
- }
-
- {
- // invoke with namelist and content, perfectly acceptable
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <invoke type=\"scxml\" namelist=\"var1\">"
- " <content>Foo!</content>"
- " </invoke>"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.size() == 0);
- }
-
- {
- // donedata with content and param, not allowed
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <donedata>"
- " <param name=\"foo\" expr=\"3\" />"
- " <content>Foo!</content>"
- " </donedata>"
- " </state>"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/donedata[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
-
- }
-
-
+ if (1) {
+ // Useless history 1
+
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"bar\">"
+ " <history id=\"bar\" />"
+ " <state id=\"baz\" />"
+ " <transition event=\"e.foo\" target=\"done\" />"
+ " <transition event=\"e.bar\" target=\"baz\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//history[@id=\"bar\"]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // Useless history 2
+
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"bar\">"
+ " <history id=\"bar\">"
+ " <transition target=\"foo\" />"
+ " </history>"
+ " <transition target=\"done\" />"
+ " <state id=\"foo\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//history[@id=\"bar\"]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // No legal completion
+
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"foo bar\">"
+ " <state id=\"foo\" />"
+ " <state id=\"bar\" />"
+ " <transition target=\"foo bar\" />"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
+ assert(issueLocations.find("//state[@id=\"start\"]/transition[1]") != issueLocations.end());
+ assert(issueLocations.size() == 2);
+ }
+
+ if (1) {
+ // attribute constraints
+
+ {
+ // initial attribute and <initial> child
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"foo\">"
+ " <initial>"
+ " <transition target=\"foo\" />"
+ " </initial>"
+ " <state id=\"foo\" />"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ {
+ // initial attribute with atomic state
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ {
+ // initial child with atomic state
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <initial>"
+ " <transition target=\"start\" />"
+ " </initial>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
+ assert(issueLocations.size() == 2); // also invalid non-child target state in initial
+ }
+
+ // combinations of namelist, content and param
+ {
+ // send with content and namelist, not allowed
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <onentry>"
+ " <send target=\"#_external\" namelist=\"var1\">"
+ " <content>Foo!</content>"
+ " </send>"
+ " </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);
+ }
+
+ {
+ // send with content and params, not allowed
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <onentry>"
+ " <send target=\"#_external\">"
+ " <param name=\"foo\" expr=\"3\" />"
+ " <content>Foo!</content>"
+ " </send>"
+ " </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);
+ }
+
+ {
+ // send with params and namelist, perfectly acceptable
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <onentry>"
+ " <send target=\"#_external\" namelist=\"foo\">"
+ " <param name=\"foo\" expr=\"3\" />"
+ " </send>"
+ " </onentry>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.size() == 0);
+ }
+
+ {
+ // invoke with content and src, not allowed
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <invoke type=\"scxml\" src=\"var1\">"
+ " <content>Foo!</content>"
+ " </invoke>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/invoke[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ {
+ // invoke with namelist and param, not allowed
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <invoke type=\"scxml\" namelist=\"var1\">"
+ " <param name=\"foo\" expr=\"3\" />"
+ " </invoke>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/invoke[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ {
+ // invoke with param and content, perfectly acceptable
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <invoke type=\"scxml\">"
+ " <param name=\"foo\" expr=\"3\" />"
+ " <content>Foo!</content>"
+ " </invoke>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.size() == 0);
+ }
+
+ {
+ // invoke with namelist and content, perfectly acceptable
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <invoke type=\"scxml\" namelist=\"var1\">"
+ " <content>Foo!</content>"
+ " </invoke>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.size() == 0);
+ }
+
+ {
+ // donedata with content and param, not allowed
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <donedata>"
+ " <param name=\"foo\" expr=\"3\" />"
+ " <content>Foo!</content>"
+ " </donedata>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/donedata[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+
+ }
+
+
if (1) {
// Transition can never be optimally enabled (conditionless, eventless)
@@ -433,204 +433,204 @@ int main(int argc, char** argv) {
assert(issueLocations.size() == 1);
}
- if (1) {
- // Initial attribute with target outside of children
-
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"foo done\">"
- " <state id=\"foo\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // Initial transition with target outside of children
-
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <initial>"
- " <transition target=\"foo done\" />"
- " </initial>"
- " <state id=\"foo\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // Initial history transition with target outside of children
-
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"bar\">"
- " <history id=\"bar\">"
- " <transition target=\"foo done\" />"
- " </history>"
- " <state id=\"foo\">"
- " <transition target=\"baz\" />"
- " </state>"
- " <state id=\"baz\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//history[@id=\"bar\"]/transition[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // Initial transition with target outside of children
-
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <initial>"
- " <transition target=\"foo done\" />"
- " </initial>"
- " <state id=\"foo\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
+ if (1) {
+ // Initial attribute with target outside of children
+
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"foo done\">"
+ " <state id=\"foo\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // Initial transition with target outside of children
+
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <initial>"
+ " <transition target=\"foo done\" />"
+ " </initial>"
+ " <state id=\"foo\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // Initial history transition with target outside of children
+
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"bar\">"
+ " <history id=\"bar\">"
+ " <transition target=\"foo done\" />"
+ " </history>"
+ " <state id=\"foo\">"
+ " <transition target=\"baz\" />"
+ " </state>"
+ " <state id=\"baz\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//history[@id=\"bar\"]/transition[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // Initial transition with target outside of children
+
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <initial>"
+ " <transition target=\"foo done\" />"
+ " </initial>"
+ " <state id=\"foo\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
if (1) {
// Initial transition with event
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <initial>"
- " <transition event=\"e.foo\" target=\"foo\" />"
- " </initial>"
- " <state id=\"foo\" />"
- " <transition event=\"e.bar\" target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <initial>"
+ " <transition event=\"e.foo\" target=\"foo\" />"
+ " </initial>"
+ " <state id=\"foo\" />"
+ " <transition event=\"e.bar\" target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
+ assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
assert(issueLocations.size() == 1);
}
- if (1) {
- // Initial transition with condition
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <initial>"
- " <transition cond=\"true\" target=\"foo\" />"
- " </initial>"
- " <state id=\"foo\" />"
- " <transition event=\"e.bar\" target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // Initial with multiple transitions
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <initial>"
- " <transition target=\"foo\" />"
- " <transition target=\"foo\" />"
- " </initial>"
- " <state id=\"foo\" />"
- " <transition event=\"e.bar\" target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/initial[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // Initial with no transitions
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\">"
- " <initial />"
- " <state id=\"foo\" />"
- " <transition event=\"e.bar\" target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//state[@id=\"start\"]/initial[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // History transition with event
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"bar\">"
- " <history id=\"bar\">"
- " <transition event=\"e.foo\" target=\"foo\" />"
- " </history>"
- " <state id=\"foo\">"
- " <state id=\"foo.s1\">"
- " <transition target=\"foo.s2\" />"
- " </state>"
- " <state id=\"foo.s2\" />"
- " </state>"
- " <transition event=\"e.bar\" target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//history[@id=\"bar\"]/transition[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
-
- if (1) {
- // History transition with condition
- const char* xml =
- "<scxml datamodel=\"ecmascript\">"
- " <state id=\"start\" initial=\"bar\">"
- " <history id=\"bar\">"
- " <transition cond=\"false\" target=\"foo\" />"
- " </history>"
- " <state id=\"foo\">"
- " <state id=\"foo.s1\">"
- " <transition target=\"foo.s2\" />"
- " </state>"
- " <state id=\"foo.s2\" />"
- " </state>"
- " <transition event=\"e.bar\" target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
- std::set<std::string> issueLocations = issueLocationsForXML(xml);
- assert(issueLocations.find("//history[@id=\"bar\"]/transition[1]") != issueLocations.end());
- assert(issueLocations.size() == 1);
- }
+ if (1) {
+ // Initial transition with condition
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <initial>"
+ " <transition cond=\"true\" target=\"foo\" />"
+ " </initial>"
+ " <state id=\"foo\" />"
+ " <transition event=\"e.bar\" target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/initial[1]/transition[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // Initial with multiple transitions
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <initial>"
+ " <transition target=\"foo\" />"
+ " <transition target=\"foo\" />"
+ " </initial>"
+ " <state id=\"foo\" />"
+ " <transition event=\"e.bar\" target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/initial[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // Initial with no transitions
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\">"
+ " <initial />"
+ " <state id=\"foo\" />"
+ " <transition event=\"e.bar\" target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//state[@id=\"start\"]/initial[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // History transition with event
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"bar\">"
+ " <history id=\"bar\">"
+ " <transition event=\"e.foo\" target=\"foo\" />"
+ " </history>"
+ " <state id=\"foo\">"
+ " <state id=\"foo.s1\">"
+ " <transition target=\"foo.s2\" />"
+ " </state>"
+ " <state id=\"foo.s2\" />"
+ " </state>"
+ " <transition event=\"e.bar\" target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//history[@id=\"bar\"]/transition[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
+
+ if (1) {
+ // History transition with condition
+ const char* xml =
+ "<scxml datamodel=\"ecmascript\">"
+ " <state id=\"start\" initial=\"bar\">"
+ " <history id=\"bar\">"
+ " <transition cond=\"false\" target=\"foo\" />"
+ " </history>"
+ " <state id=\"foo\">"
+ " <state id=\"foo.s1\">"
+ " <transition target=\"foo.s2\" />"
+ " </state>"
+ " <state id=\"foo.s2\" />"
+ " </state>"
+ " <transition event=\"e.bar\" target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.find("//history[@id=\"bar\"]/transition[1]") != issueLocations.end());
+ assert(issueLocations.size() == 1);
+ }
if (1) {
// Send to unknown IO Processor
@@ -730,9 +730,9 @@ int main(int argc, char** argv) {
" <send>"
" <param expr=\"%2345\" />"
" </send>"
- " <send>"
- " <content expr=\"%2345\" />"
- " </send>"
+ " <send>"
+ " <content expr=\"%2345\" />"
+ " </send>"
" </onentry>"
" </state>"
"</scxml>";
@@ -742,7 +742,7 @@ int main(int argc, char** argv) {
assert(issueLocations.find("//data[@id=\"foo\"]") != issueLocations.end());
assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/assign[1]") != issueLocations.end());
assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/send[1]/param[1]") != issueLocations.end());
- assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/send[2]/content[1]") != issueLocations.end());
+ assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/send[2]/content[1]") != issueLocations.end());
assert(issueLocations.size() == 5);
}