diff options
Diffstat (limited to 'test/src/test-predicates.cpp')
-rw-r--r-- | test/src/test-predicates.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/test/src/test-predicates.cpp b/test/src/test-predicates.cpp index 7ba9225..0aff104 100644 --- a/test/src/test-predicates.cpp +++ b/test/src/test-predicates.cpp @@ -1,5 +1,6 @@ #define protected public #include "uscxml/Interpreter.h" +#include "uscxml/util/String.h" #undef protected #include <iostream> @@ -54,35 +55,35 @@ int main(int argc, char** argv) { { std::string idrefs("id1"); - std::list<std::string> tokenizedIdrefs = InterpreterImpl::tokenizeIdRefs(idrefs); + std::list<std::string> tokenizedIdrefs = tokenize(idrefs); assert(tokenizedIdrefs.size() == 1); assert(tokenizedIdrefs.front().compare("id1") == 0); } { std::string idrefs(" id1"); - std::list<std::string> tokenizedIdrefs = InterpreterImpl::tokenizeIdRefs(idrefs); + std::list<std::string> tokenizedIdrefs = tokenize(idrefs); assert(tokenizedIdrefs.size() == 1); assert(tokenizedIdrefs.front().compare("id1") == 0); } { std::string idrefs(" id1 "); - std::list<std::string> tokenizedIdrefs = InterpreterImpl::tokenizeIdRefs(idrefs); + std::list<std::string> tokenizedIdrefs = tokenize(idrefs); assert(tokenizedIdrefs.size() == 1); assert(tokenizedIdrefs.front().compare("id1") == 0); } { std::string idrefs(" \tid1\n "); - std::list<std::string> tokenizedIdrefs = InterpreterImpl::tokenizeIdRefs(idrefs); + std::list<std::string> tokenizedIdrefs = tokenize(idrefs); assert(tokenizedIdrefs.size() == 1); assert(tokenizedIdrefs.front().compare("id1") == 0); } { std::string idrefs("id1 id2 id3"); - std::list<std::string> tokenizedIdrefs = InterpreterImpl::tokenizeIdRefs(idrefs); + std::list<std::string> tokenizedIdrefs = tokenize(idrefs); assert(tokenizedIdrefs.size() == 3); assert(tokenizedIdrefs.front().compare("id1") == 0); tokenizedIdrefs.pop_front(); @@ -93,7 +94,7 @@ int main(int argc, char** argv) { { std::string idrefs("\t id1 \nid2\n\n id3\t"); - std::list<std::string> tokenizedIdrefs = InterpreterImpl::tokenizeIdRefs(idrefs); + std::list<std::string> tokenizedIdrefs = tokenize(idrefs); assert(tokenizedIdrefs.size() == 3); assert(tokenizedIdrefs.front().compare("id1") == 0); tokenizedIdrefs.pop_front(); @@ -104,7 +105,7 @@ int main(int argc, char** argv) { { std::string idrefs("id1 \nid2 \tid3"); - std::list<std::string> tokenizedIdrefs = InterpreterImpl::tokenizeIdRefs(idrefs); + std::list<std::string> tokenizedIdrefs = tokenize(idrefs); assert(tokenizedIdrefs.size() == 3); assert(tokenizedIdrefs.front().compare("id1") == 0); tokenizedIdrefs.pop_front(); @@ -115,20 +116,20 @@ int main(int argc, char** argv) { std::string transEvents; transEvents = "error"; - assert(InterpreterImpl::nameMatch(transEvents, "error")); - assert(!InterpreterImpl::nameMatch(transEvents, "foo")); + assert(nameMatch(transEvents, "error")); + assert(!nameMatch(transEvents, "foo")); transEvents = " error foo"; - assert(InterpreterImpl::nameMatch(transEvents, "error")); - assert(InterpreterImpl::nameMatch(transEvents, "error.send")); - assert(InterpreterImpl::nameMatch(transEvents, "error.send.failed")); - assert(InterpreterImpl::nameMatch(transEvents, "foo")); - assert(InterpreterImpl::nameMatch(transEvents, "foo.bar")); - assert(!InterpreterImpl::nameMatch(transEvents, "errors.my.custom")); - assert(!InterpreterImpl::nameMatch(transEvents, "errorhandler.mistake")); + assert(nameMatch(transEvents, "error")); + assert(nameMatch(transEvents, "error.send")); + assert(nameMatch(transEvents, "error.send.failed")); + assert(nameMatch(transEvents, "foo")); + assert(nameMatch(transEvents, "foo.bar")); + assert(!nameMatch(transEvents, "errors.my.custom")); + assert(!nameMatch(transEvents, "errorhandler.mistake")); // is the event name case sensitive? - // assert(!InterpreterImpl::nameMatch(transEvents, "errOr.send")); - assert(!InterpreterImpl::nameMatch(transEvents, "foobar")); + // assert(!nameMatch(transEvents, "errOr.send")); + assert(!nameMatch(transEvents, "foobar")); } catch(std::exception e) { std::cout << e.what(); return false; |