summaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-12-26 22:29:22 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-12-26 22:29:22 (GMT)
commit42437db418574f2a80d098e568b9498a21343800 (patch)
tree291c1983d8ad14b97be19fda7f3601b9d83c2031 /test/src
parent330576fcb4d97504e0d6951067b753499d91b541 (diff)
downloaduscxml-42437db418574f2a80d098e568b9498a21343800.zip
uscxml-42437db418574f2a80d098e568b9498a21343800.tar.gz
uscxml-42437db418574f2a80d098e568b9498a21343800.tar.bz2
Plenty of smaller bug-fixes for uscxml-transform and PROMELA datamodel
Diffstat (limited to 'test/src')
-rw-r--r--test/src/test-w3c.cpp76
1 files changed, 9 insertions, 67 deletions
diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp
index e2efa59..c7f136d 100644
--- a/test/src/test-w3c.cpp
+++ b/test/src/test-w3c.cpp
@@ -24,74 +24,16 @@ static std::string documentURI;
int retCode = EXIT_FAILURE;
-class W3CStatusMonitor : public uscxml::InterpreterMonitor {
+class W3CStatusMonitor : public uscxml::StateTransitionMonitor {
- void beforeTakingTransition(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
- std::cout << "Transition: " << uscxml::DOMUtils::xPathForNode(transition) << std::endl;
+void beforeCompletion(uscxml::Interpreter interpreter) {
+ if (interpreter.getConfiguration().size() == 1 && interpreter.isInState("pass")) {
+ std::cout << "TEST SUCCEEDED" << std::endl;
+ retCode = EXIT_SUCCESS;
+ return;
}
-
- void onStableConfiguration(uscxml::Interpreter interpreter) {
- std::cout << "Config: {";
- printNodeSet(interpreter.getConfiguration());
- std::cout << "}" << std::endl;
- }
-
- void beforeProcessingEvent(uscxml::Interpreter interpreter, const uscxml::Event& event) {
- std::cout << "Event: " << event.name << std::endl;
- }
-
- void beforeExitingState(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- exitingStates.push_back(state);
- if (!moreComing) {
- std::cout << "Exiting: {";
- printNodeSet(exitingStates);
- std::cout << "}" << std::endl;
- exitingStates = Arabica::XPath::NodeSet<std::string>();
- }
- }
-
- void beforeEnteringState(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- enteringStates.push_back(state);
- if (!moreComing) {
- std::cout << "Entering: {";
- printNodeSet(enteringStates);
- std::cout << "}" << std::endl;
- enteringStates = Arabica::XPath::NodeSet<std::string>();
- }
-
- }
-
- void printNodeSet(const Arabica::XPath::NodeSet<std::string>& config) {
- std::string seperator;
- for (int i = 0; i < config.size(); i++) {
- std::cout << seperator << ATTR_CAST(config[i], "id");
- seperator = ", ";
- }
- }
-
- void beforeCompletion(uscxml::Interpreter interpreter) {
- Arabica::XPath::NodeSet<std::string> config = interpreter.getConfiguration();
- if (config.size() == 1) {
- if (withFlattening) {
- std::cout << ATTR_CAST(config[0], "id") << std::endl;
- if (boost::starts_with(ATTR_CAST(config[0], "id"), "active:{pass")) {
- std::cout << "TEST SUCCEEDED" << std::endl;
- retCode = EXIT_SUCCESS;
- return;
- }
- } else {
- if (boost::iequals(ATTR_CAST(config[0], "id"), "pass")) {
- std::cout << "TEST SUCCEEDED" << std::endl;
- retCode = EXIT_SUCCESS;
- return;
- }
- }
- }
- std::cout << "TEST FAILED" << std::endl;
- }
-
- Arabica::XPath::NodeSet<std::string> exitingStates;
- Arabica::XPath::NodeSet<std::string> enteringStates;
+ std::cout << "TEST FAILED" << std::endl;
+}
};
int main(int argc, char** argv) {
@@ -143,7 +85,7 @@ int main(int argc, char** argv) {
} else {
interpreter = Interpreter::fromURL(documentURI);
}
-
+
if (delayFactor != 1) {
Arabica::DOM::Document<std::string> document = interpreter.getDocument();
Arabica::DOM::Element<std::string> root = document.getDocumentElement();