summaryrefslogtreecommitdiffstats
path: root/test/src/test-predicates.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-12-20 21:34:09 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-12-20 21:34:09 (GMT)
commit498f6f80e9ca01236ca1491596875ab7eb4cd8c3 (patch)
treee627ae19475bb93a98dfa50db1950f6e3403f569 /test/src/test-predicates.cpp
parentd779abe6ff76a78f92d229fcf1f006f5cf1f9295 (diff)
downloaduscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.zip
uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.tar.gz
uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.tar.bz2
Refactoring finished
Support datamodels, invokers and ioprocessors as plugins Comply to HTTP1.1 by sending host header field Started prolog datamodel
Diffstat (limited to 'test/src/test-predicates.cpp')
-rw-r--r--test/src/test-predicates.cpp108
1 files changed, 54 insertions, 54 deletions
diff --git a/test/src/test-predicates.cpp b/test/src/test-predicates.cpp
index 0494c24..2905f40 100644
--- a/test/src/test-predicates.cpp
+++ b/test/src/test-predicates.cpp
@@ -3,58 +3,58 @@
#undef protected
int main(int argc, char** argv) {
- if (argc != 2) {
- std::cerr << "Expected path to test-predicates.scxml" << std::endl;
- exit(EXIT_FAILURE);
- }
-
- using namespace uscxml;
- using namespace Arabica::DOM;
- using namespace Arabica::XPath;
-
- Interpreter* interpreter = Interpreter::fromURI(argv[1]);
-
- Node<std::string> atomicState = interpreter->getState("atomic");
- assert(Interpreter::isAtomic(atomicState));
- assert(!Interpreter::isParallel(atomicState));
- assert(!Interpreter::isCompound(atomicState));
-
- Node<std::string> compoundState = interpreter->getState("compound");
- assert(!Interpreter::isAtomic(compoundState));
- assert(!Interpreter::isParallel(compoundState));
- assert(Interpreter::isCompound(compoundState));
-
- Node<std::string> parallelState = interpreter->getState("parallel");
- assert(!Interpreter::isAtomic(parallelState));
- assert(Interpreter::isParallel(parallelState));
- assert(!Interpreter::isCompound(parallelState)); // parallel states are not compound!
-
- Node<std::string> initialState = interpreter->getInitialState();
- assert(initialState == atomicState);
-
- NodeSet<std::string> childs = interpreter->getChildStates(compoundState);
- Node<std::string> compundChild1 = interpreter->getState("compundChild1");
- Node<std::string> compundChild2 = interpreter->getState("compundChild2");
- assert(childs.size() > 0);
- assert(Interpreter::isMember(compundChild1, childs));
- assert(Interpreter::isMember(compundChild2, childs));
- assert(!Interpreter::isMember(compoundState, childs));
-
- assert(Interpreter::isDescendant(compundChild1, compoundState));
-
- std::string transEvents;
- transEvents = "error";
- assert(Interpreter::nameMatch(transEvents, "error"));
- assert(!Interpreter::nameMatch(transEvents, "foo"));
-
- transEvents = "error foo";
- assert(Interpreter::nameMatch(transEvents, "error"));
- assert(Interpreter::nameMatch(transEvents, "error.send"));
- assert(Interpreter::nameMatch(transEvents, "error.send.failed"));
- assert(Interpreter::nameMatch(transEvents, "foo"));
- assert(Interpreter::nameMatch(transEvents, "foo.bar"));
- assert(!Interpreter::nameMatch(transEvents, "errors.my.custom"));
- assert(!Interpreter::nameMatch(transEvents, "errorhandler.mistake"));
- assert(!Interpreter::nameMatch(transEvents, "errOr.send"));
- assert(!Interpreter::nameMatch(transEvents, "foobar"));
+ if (argc != 2) {
+ std::cerr << "Expected path to test-predicates.scxml" << std::endl;
+ exit(EXIT_FAILURE);
+ }
+
+ using namespace uscxml;
+ using namespace Arabica::DOM;
+ using namespace Arabica::XPath;
+
+ Interpreter* interpreter = Interpreter::fromURI(argv[1]);
+
+ Node<std::string> atomicState = interpreter->getState("atomic");
+ assert(Interpreter::isAtomic(atomicState));
+ assert(!Interpreter::isParallel(atomicState));
+ assert(!Interpreter::isCompound(atomicState));
+
+ Node<std::string> compoundState = interpreter->getState("compound");
+ assert(!Interpreter::isAtomic(compoundState));
+ assert(!Interpreter::isParallel(compoundState));
+ assert(Interpreter::isCompound(compoundState));
+
+ Node<std::string> parallelState = interpreter->getState("parallel");
+ assert(!Interpreter::isAtomic(parallelState));
+ assert(Interpreter::isParallel(parallelState));
+ assert(!Interpreter::isCompound(parallelState)); // parallel states are not compound!
+
+ Node<std::string> initialState = interpreter->getInitialState();
+ assert(initialState == atomicState);
+
+ NodeSet<std::string> childs = interpreter->getChildStates(compoundState);
+ Node<std::string> compundChild1 = interpreter->getState("compundChild1");
+ Node<std::string> compundChild2 = interpreter->getState("compundChild2");
+ assert(childs.size() > 0);
+ assert(Interpreter::isMember(compundChild1, childs));
+ assert(Interpreter::isMember(compundChild2, childs));
+ assert(!Interpreter::isMember(compoundState, childs));
+
+ assert(Interpreter::isDescendant(compundChild1, compoundState));
+
+ std::string transEvents;
+ transEvents = "error";
+ assert(Interpreter::nameMatch(transEvents, "error"));
+ assert(!Interpreter::nameMatch(transEvents, "foo"));
+
+ transEvents = "error foo";
+ assert(Interpreter::nameMatch(transEvents, "error"));
+ assert(Interpreter::nameMatch(transEvents, "error.send"));
+ assert(Interpreter::nameMatch(transEvents, "error.send.failed"));
+ assert(Interpreter::nameMatch(transEvents, "foo"));
+ assert(Interpreter::nameMatch(transEvents, "foo.bar"));
+ assert(!Interpreter::nameMatch(transEvents, "errors.my.custom"));
+ assert(!Interpreter::nameMatch(transEvents, "errorhandler.mistake"));
+ assert(!Interpreter::nameMatch(transEvents, "errOr.send"));
+ assert(!Interpreter::nameMatch(transEvents, "foobar"));
} \ No newline at end of file