diff options
Diffstat (limited to 'test/src/test-lifecycle.cpp')
-rw-r--r-- | test/src/test-lifecycle.cpp | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/test/src/test-lifecycle.cpp b/test/src/test-lifecycle.cpp index 7cbb68b..22c724a 100644 --- a/test/src/test-lifecycle.cpp +++ b/test/src/test-lifecycle.cpp @@ -410,108 +410,6 @@ int main(int argc, char** argv) { assert(interpreter.step() == USCXML_MICROSTEPPED); assert(interpreter.step() == USCXML_FINISHED); } - -#if 0 - - - if (0) { - // macrostep in between - const char* xml = - "<scxml>" - " <state id=\"start\">" - " <onentry>" - " <send event=\"continue\" delay=\"2s\"/>" - " </onentry>" - " <transition target=\"s2\" event=\"continue\" />" - " </state>" - " <state id=\"s2\">" - " <transition target=\"done\" />" - " </state>" - " <final id=\"done\" />" - "</scxml>"; - - Interpreter interpreter = Interpreter::fromXML(xml); - - assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); - assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); - interpreter.reset(); - assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); - assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); - } - - if (1) { - // macrostep in between, external event - const char* xml = - "<scxml>" - " <state id=\"start\">" - " <transition target=\"s2\" event=\"continue\" />" - " </state>" - " <state id=\"s2\">" - " <transition target=\"done\" />" - " </state>" - " <final id=\"done\" />" - "</scxml>"; - - Interpreter interpreter = Interpreter::fromXML(xml); - - assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); - interpreter.receive(Event("continue")); - assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); - interpreter.reset(); - assert(interpreter.getState() == uscxml::InterpreterState::USCXML_INSTANTIATED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_IDLE); - interpreter.receive(Event("continue")); - assert(interpreter.step(true) == uscxml::InterpreterState::USCXML_MACROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_MICROSTEPPED); - assert(interpreter.step() == uscxml::InterpreterState::USCXML_FINISHED); - } - - if (1) { - // macrostep in between, external event - const char* xml = - "<scxml>" - " <state id=\"start\">" - " <transition target=\"s2\" event=\"continue\" />" - " </state>" - " <state id=\"s2\">" - " <transition target=\"done\" />" - " </state>" - " <final id=\"done\" />" - "</scxml>"; - - Interpreter interpreter = Interpreter::fromXML(xml); - interpreter.start(); - // assume interpreter is started - assert(interpreter.getState() & InterpreterState::USCXML_THREAD_STARTED); - tthread::this_thread::sleep_for(tthread::chrono::milliseconds(100)); - - // assume it is started and running - std::cout << interpreter.getState() << std::endl; - - assert(interpreter.getState() & InterpreterState::USCXML_THREAD_STARTED); - assert(interpreter.getState() & InterpreterState::USCXML_THREAD_RUNNING); - assert(interpreter.getState() & InterpreterState::USCXML_IDLE); - - interpreter.receive(Event("continue")); - tthread::this_thread::sleep_for(tthread::chrono::milliseconds(200)); - - std::cout << interpreter.getState() << std::endl; - int state = interpreter.getState(); - assert(state & InterpreterState::USCXML_FINISHED); - assert(!(state & InterpreterState::USCXML_THREAD_STARTED)); - assert(!(state & InterpreterState::USCXML_THREAD_RUNNING)); - - } -#endif } return EXIT_SUCCESS; }
\ No newline at end of file |