summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Radomski <sradomski@mintwerk.de>2016-04-28 11:00:10 (GMT)
committerStefan Radomski <sradomski@mintwerk.de>2016-04-28 11:00:10 (GMT)
commit4750623a631e72c7a8be8d4172b33c83f20113a6 (patch)
tree64d626708595d3fe5438d75af1616870db724800 /test
parent454fa66e503e41465cba75a6bea00463a93a20ef (diff)
downloaduscxml-4750623a631e72c7a8be8d4172b33c83f20113a6.zip
uscxml-4750623a631e72c7a8be8d4172b33c83f20113a6.tar.gz
uscxml-4750623a631e72c7a8be8d4172b33c83f20113a6.tar.bz2
Fixed issue 64 and beautified code again
Diffstat (limited to 'test')
-rw-r--r--test/src/issues/test-issue62.cpp128
-rw-r--r--test/src/issues/test-issue63.cpp80
-rw-r--r--test/src/issues/test-issue64.scxml16
-rw-r--r--test/src/test-c-machine.cpp4
4 files changed, 122 insertions, 106 deletions
diff --git a/test/src/issues/test-issue62.cpp b/test/src/issues/test-issue62.cpp
index 4074177..db44dad 100644
--- a/test/src/issues/test-issue62.cpp
+++ b/test/src/issues/test-issue62.cpp
@@ -4,69 +4,69 @@
using namespace uscxml;
int main(int argc, char** argv) {
- google::LogToStderr();
- google::InitGoogleLogging(argv[0]);
-
- const char* scxmlContent =
- "<scxml datamodel=\"lua\" initial=\"init\" name=\"scxml_root\" version=\"1.0\" xmlns=\"http://www.w3.org/2005/07/scxml\"> "
- " <state id=\"init\"> "
- " <transition target=\"InvokeParent\"/> "
- " </state> "
- " <final id=\"FinalShape1\"/> "
- " <state id=\"InvokeParent\"> "
- " <invoke autoforward=\"true\" id=\"test_invoke\" type=\"scxml\"> "
- " <content> "
- " <scxml datamodel=\"lua\" initial=\"On\" name=\"ScxmlShape1\" version=\"1.0\" xmlns=\"http://www.w3.org/2005/07/scxml\"> "
- " <state id=\"On\"> "
- " <onentry> "
- " <script>print('TEST LOGGING FROM INVOKE SOURCE')</script> "
- " </onentry> "
- " <transition target=\"Off\"/> "
- " </state> "
- " <state id=\"Off\"> "
- " <transition event=\"inside_invoke\" target=\"End\"/> "
- " </state> "
- " <final id=\"End\"/> "
- " </scxml> "
- " </content> "
- " </invoke> "
- " <transition event=\"done.invoke.test_invoke\" target=\"FinalShape1\"/> "
- " <transition event=\"move_here\" target=\"StateXXX\"/> "
- " </state> "
- " <state id=\"StateXXX\"> "
- " <transition target=\"FinalShape1\"/> "
- " </state> "
- "</scxml> ";
-
- std::string msg;
-
- uscxml::Interpreter scxml = uscxml::Interpreter(uscxml::Interpreter::fromXML(scxmlContent, ""));
- std::list<InterpreterIssue> issues = scxml.validate();
- for (std::list<InterpreterIssue>::iterator issueIter = issues.begin(); issueIter != issues.end(); issueIter++) {
- std::cout << *issueIter;
- }
-
- scxml.addMonitor(new StateTransitionMonitor());
-
- uscxml::InterpreterState state;
-
- // assume initial stable configuration
- do {
- state = scxml.step();
- } while(state > 0);
-
- scxml.receive(Event("move_here"));
- scxml.receive(Event("inside_invoke"));
+ google::LogToStderr();
+ google::InitGoogleLogging(argv[0]);
+
+ const char* scxmlContent =
+ "<scxml datamodel=\"lua\" initial=\"init\" name=\"scxml_root\" version=\"1.0\" xmlns=\"http://www.w3.org/2005/07/scxml\"> "
+ " <state id=\"init\"> "
+ " <transition target=\"InvokeParent\"/> "
+ " </state> "
+ " <final id=\"FinalShape1\"/> "
+ " <state id=\"InvokeParent\"> "
+ " <invoke autoforward=\"true\" id=\"test_invoke\" type=\"scxml\"> "
+ " <content> "
+ " <scxml datamodel=\"lua\" initial=\"On\" name=\"ScxmlShape1\" version=\"1.0\" xmlns=\"http://www.w3.org/2005/07/scxml\"> "
+ " <state id=\"On\"> "
+ " <onentry> "
+ " <script>print('TEST LOGGING FROM INVOKE SOURCE')</script> "
+ " </onentry> "
+ " <transition target=\"Off\"/> "
+ " </state> "
+ " <state id=\"Off\"> "
+ " <transition event=\"inside_invoke\" target=\"End\"/> "
+ " </state> "
+ " <final id=\"End\"/> "
+ " </scxml> "
+ " </content> "
+ " </invoke> "
+ " <transition event=\"done.invoke.test_invoke\" target=\"FinalShape1\"/> "
+ " <transition event=\"move_here\" target=\"StateXXX\"/> "
+ " </state> "
+ " <state id=\"StateXXX\"> "
+ " <transition target=\"FinalShape1\"/> "
+ " </state> "
+ "</scxml> ";
+
+ std::string msg;
+
+ uscxml::Interpreter scxml = uscxml::Interpreter(uscxml::Interpreter::fromXML(scxmlContent, ""));
+ std::list<InterpreterIssue> issues = scxml.validate();
+ for (std::list<InterpreterIssue>::iterator issueIter = issues.begin(); issueIter != issues.end(); issueIter++) {
+ std::cout << *issueIter;
+ }
+
+ scxml.addMonitor(new StateTransitionMonitor());
+
+ uscxml::InterpreterState state;
+
+ // assume initial stable configuration
+ do {
+ state = scxml.step();
+ } while(state > 0);
+
+ scxml.receive(Event("move_here"));
+ scxml.receive(Event("inside_invoke"));
+
+ while(state != uscxml::USCXML_FINISHED) {
+ do {
+ state = scxml.step(true);
+ } while(state > 0);
+ }
+
+ std::cout << "************************************" << std::endl;
+ std::cout << "Successfully finished state machine!" << std::endl;
+
+ return EXIT_SUCCESS;
- while(state != uscxml::USCXML_FINISHED) {
- do {
- state = scxml.step(true);
- } while(state > 0);
- }
-
- std::cout << "************************************" << std::endl;
- std::cout << "Successfully finished state machine!" << std::endl;
-
- return EXIT_SUCCESS;
-
} \ No newline at end of file
diff --git a/test/src/issues/test-issue63.cpp b/test/src/issues/test-issue63.cpp
index 12a471c..5cedcad 100644
--- a/test/src/issues/test-issue63.cpp
+++ b/test/src/issues/test-issue63.cpp
@@ -5,44 +5,44 @@
using namespace uscxml;
int main(int argc, char** argv) {
- google::LogToStderr();
- google::InitGoogleLogging(argv[0]);
-
- const char* scxmlContent =
- "<scxml datamodel=\"lua\" initial=\"init\" name=\"scxml_root\" version=\"1.0\" xmlns=\"http://www.w3.org/2005/07/scxml\">"
- " <state id=\"init\"> "
- " <onentry> <script> print('Hello, World!') </script> </onentry> "
- " <onentry> <script> print(\"Hello, World!\") </script> </onentry> "
- " <onentry> <script> print('Hello, &quot;World&quot;') </script> </onentry> "
- " <onentry> <script><![CDATA[ print('Hello, \"World\"') ]]></script> </onentry> "
- " <onentry> <script> print(&quot;Hello, world!&quot;) </script> </onentry> "
- " <transition target=\"FinalShape1\"/> "
- " <transition cond=\"_event.data==&quot;string value&quot;\" event=\"test\" target=\"FinalShape1\"/> "
- " </state> "
- " <final id=\"FinalShape1\"/> "
- "</scxml> ";
-
- std::string msg;
-
- uscxml::Interpreter scxml = uscxml::Interpreter(uscxml::Interpreter::fromXML(scxmlContent, ""));
-
- std::list<InterpreterIssue> issues = scxml.validate();
- for (std::list<InterpreterIssue>::iterator issueIter = issues.begin(); issueIter != issues.end(); issueIter++) {
- std::cout << *issueIter << std::endl;
- }
-
- scxml.addMonitor(new StateTransitionMonitor());
-
- uscxml::InterpreterState state;
-
- do {
-
- state = scxml.step();
- } while(state != uscxml::USCXML_FINISHED && state != uscxml::USCXML_DESTROYED);
-
- std::cout << "************************************" << std::endl;
- std::cout << "Successfully finished state machine!" << std::endl;
-
- return EXIT_SUCCESS;
-
+ google::LogToStderr();
+ google::InitGoogleLogging(argv[0]);
+
+ const char* scxmlContent =
+ "<scxml datamodel=\"lua\" initial=\"init\" name=\"scxml_root\" version=\"1.0\" xmlns=\"http://www.w3.org/2005/07/scxml\">"
+ " <state id=\"init\"> "
+ " <onentry> <script> print('Hello, World!') </script> </onentry> "
+ " <onentry> <script> print(\"Hello, World!\") </script> </onentry> "
+ " <onentry> <script> print('Hello, &quot;World&quot;') </script> </onentry> "
+ " <onentry> <script><![CDATA[ print('Hello, \"World\"') ]]></script> </onentry> "
+ " <onentry> <script> print(&quot;Hello, world!&quot;) </script> </onentry> "
+ " <transition target=\"FinalShape1\"/> "
+ " <transition cond=\"_event.data==&quot;string value&quot;\" event=\"test\" target=\"FinalShape1\"/> "
+ " </state> "
+ " <final id=\"FinalShape1\"/> "
+ "</scxml> ";
+
+ std::string msg;
+
+ uscxml::Interpreter scxml = uscxml::Interpreter(uscxml::Interpreter::fromXML(scxmlContent, ""));
+
+ std::list<InterpreterIssue> issues = scxml.validate();
+ for (std::list<InterpreterIssue>::iterator issueIter = issues.begin(); issueIter != issues.end(); issueIter++) {
+ std::cout << *issueIter << std::endl;
+ }
+
+ scxml.addMonitor(new StateTransitionMonitor());
+
+ uscxml::InterpreterState state;
+
+ do {
+
+ state = scxml.step();
+ } while(state != uscxml::USCXML_FINISHED && state != uscxml::USCXML_DESTROYED);
+
+ std::cout << "************************************" << std::endl;
+ std::cout << "Successfully finished state machine!" << std::endl;
+
+ return EXIT_SUCCESS;
+
} \ No newline at end of file
diff --git a/test/src/issues/test-issue64.scxml b/test/src/issues/test-issue64.scxml
new file mode 100644
index 0000000..0969b5f
--- /dev/null
+++ b/test/src/issues/test-issue64.scxml
@@ -0,0 +1,16 @@
+<scxml datamodel="lua" initial="start" name="root" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
+ <final id="end"/>
+ <state id="start">
+ <invoke id="test_invoke" type="scxml">
+ <content>
+ <scxml datamodel="lua" name="scxml_invoke" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
+ <state id="start">
+ <transition target="end"/>
+ </state>
+ <final id="end"/>
+ </scxml>
+ </content>
+ </invoke>
+ <transition event="done.invoke.test_invoke" target="end"/>
+ </state>
+</scxml>
diff --git a/test/src/test-c-machine.cpp b/test/src/test-c-machine.cpp
index d069cfe..9ee3f1f 100644
--- a/test/src/test-c-machine.cpp
+++ b/test/src/test-c-machine.cpp
@@ -591,8 +591,8 @@ public:
if (feInfo->currIteration < feInfo->iterations) {
USER_DATA(ctx)->dataModel.setForeach((foreach->item != NULL ? foreach->item : ""),
(foreach->array != NULL ? foreach->array : ""),
- (foreach->index != NULL ? foreach->index : ""),
- feInfo->currIteration);
+ (foreach->index != NULL ? foreach->index : ""),
+ feInfo->currIteration);
feInfo->currIteration++;
return USCXML_ERR_OK;
}