diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-04-22 10:21:14 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-04-22 10:21:14 (GMT) |
commit | c761e5f3931e4709f2736d5c3c0e11dc7b61ded5 (patch) | |
tree | 196e67745afb35f3fe76a85014160b53c0e21e57 /test/src/issues | |
parent | a7cb1ba3d1c8e1d60387bc9a81ca5cded0c513d0 (diff) | |
download | uscxml-c761e5f3931e4709f2736d5c3c0e11dc7b61ded5.zip uscxml-c761e5f3931e4709f2736d5c3c0e11dc7b61ded5.tar.gz uscxml-c761e5f3931e4709f2736d5c3c0e11dc7b61ded5.tar.bz2 |
Minor bug-fixes and issue62 prepared
Diffstat (limited to 'test/src/issues')
-rw-r--r-- | test/src/issues/test-issue62.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/src/issues/test-issue62.cpp b/test/src/issues/test-issue62.cpp new file mode 100644 index 0000000..b75693c --- /dev/null +++ b/test/src/issues/test-issue62.cpp @@ -0,0 +1,69 @@ +#include "uscxml/Interpreter.h" +#include "glog/logging.h" + +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, "")); + 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(); + } while(state > 0); + + } + + std::cout << "************************************" << std::endl; + std::cout << "Successfully finished state machine!" << std::endl; + + return EXIT_SUCCESS; + +}
\ No newline at end of file |