diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2015-04-02 11:44:48 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2015-04-02 11:44:48 (GMT) |
commit | 81aa1c79dd158aa7bc76876552e4b1d05ecea656 (patch) | |
tree | 4b590410d4042c156cfd3d4e874f3a329390a72b /test/src/test-promela-parser.cpp | |
parent | ff86d690dc02d7dd495000331d378e7d8eb688ac (diff) | |
download | uscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.zip uscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.tar.gz uscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.tar.bz2 |
Reactivated PHP bindings and some work on PROMELA
Diffstat (limited to 'test/src/test-promela-parser.cpp')
-rw-r--r-- | test/src/test-promela-parser.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/src/test-promela-parser.cpp b/test/src/test-promela-parser.cpp index 00cc347..8c8f2b4 100644 --- a/test/src/test-promela-parser.cpp +++ b/test/src/test-promela-parser.cpp @@ -9,13 +9,68 @@ #include <assert.h> #include <boost/algorithm/string.hpp> #include <iostream> +#include <DOM/Document.hpp> using namespace uscxml; using namespace boost; +using namespace Arabica::DOM; extern int promela_debug; void testInlinePromela() { + + DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); + Document<std::string> document = domFactory.createDocument("", "", 0); + + { + std::string test = "\ + promela-code This is foo!\ + "; + + Comment<std::string> comment = document.createComment(test); + PromelaInline inl(comment); + assert(inl.type == PromelaInline::PROMELA_CODE); + assert(inl.content == "This is foo!"); + } + + { + std::string test = "\ + promela-code\n \ + This is foo!\ + "; + + Comment<std::string> comment = document.createComment(test); + PromelaInline inl(comment); + assert(inl.type == PromelaInline::PROMELA_CODE); + assert(inl.content == "This is foo!"); + } + + { + std::string test = "\ + promela-event\n \ + [{\"name\": \"e1\", \"data\": { \"foo\": \"some string\" }}, \ + {\"name\": \"e1\", \"data\": { \"bar\": 12 }}]"; + + Comment<std::string> comment = document.createComment(test); + PromelaInline inl(comment); + assert(inl.type == PromelaInline::PROMELA_EVENT_ONLY); + + PromelaEventSource es(inl); + assert(es.events.array.size() == 2); + + } + + { + Interpreter interpreter = Interpreter::fromURL("/Users/sradomski/Documents/TK/Code/uscxml/test/uscxml/promela/test-event-source-auto.scxml"); + assert(interpreter); + PromelaInlines inls(interpreter.getDocument().getDocumentElement()); + + assert(inls.getAllOfType(PromelaInline::PROMELA_EVENT_ONLY).size() == 1); + assert(inls.getAllOfType(PromelaInline::PROMELA_EVENT_ALL_BUT).size() == 1); + interpreter.getImpl()->getState("s0"); + } + +#if 0 { std::string test = "\ #promela-inline:\n \ @@ -169,6 +224,7 @@ void testInlinePromela() { assert(pmlES.sequences.size() == 0); assert(boost::trim_copy(pmlES.source.content) == "This is foo!"); } +#endif } void checkTokenLocations(const std::string& expr, PromelaParserNode* ast) { |