diff options
Diffstat (limited to 'test/src/test-snippets.cpp')
-rw-r--r-- | test/src/test-snippets.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/src/test-snippets.cpp b/test/src/test-snippets.cpp new file mode 100644 index 0000000..a9625b1 --- /dev/null +++ b/test/src/test-snippets.cpp @@ -0,0 +1,35 @@ +/** + * This file contains all the snippets in the doxygen documentation. + * + * It is not actually a test as such, but makes sure that the snippets will + * actually compile and do what we claim they do. + */ + +#include "uscxml/config.h" +#include "uscxml/Interpreter.h" + +using namespace uscxml; + +void microstep_snippet() { + + Interpreter scxml = Interpreter::fromURL("https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/null/test436.scxml"); + +//! [Performing a microstep] + InterpreterState state = uscxml::USCXML_UNDEF; + while((state = scxml.step()) != uscxml::USCXML_FINISHED) { + switch (state) { + case USCXML_MICROSTEPPED: + case USCXML_MACROSTEPPED: + /* Interpreter performed a microstep */ + break; + default: + break; + } + } +//! [Performing a microstep] + +} + +int main(int argc, char** argv) { + microstep_snippet(); +}
\ No newline at end of file |