summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt5
-rw-r--r--test/samples/uscxml/test-initial-config.scxml58
-rw-r--r--test/src/test-initial-config.cpp36
3 files changed, 99 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ba332c2..983e179 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -63,6 +63,11 @@ target_link_libraries(test-url uscxml)
add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-url)
set_target_properties(test-url PROPERTIES FOLDER "Tests")
+# add_executable(test-initial-config src/test-initial-config.cpp)
+# target_link_libraries(test-initial-config uscxml)
+# add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-initial-config ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-initial-config.scxml)
+# set_target_properties(test-initial-config PROPERTIES FOLDER "Tests")
+
add_executable(test-datamodel src/test-datamodel.cpp)
target_link_libraries(test-datamodel uscxml)
add_test(test-datamodel ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-datamodel)
diff --git a/test/samples/uscxml/test-initial-config.scxml b/test/samples/uscxml/test-initial-config.scxml
new file mode 100644
index 0000000..cac0b8a
--- /dev/null
+++ b/test/samples/uscxml/test-initial-config.scxml
@@ -0,0 +1,58 @@
+<scxml name="CuCo" version="0.9" xmlns="http://www.w3.org/2005/07/scxml">
+ <parallel id="MAIN-PARALLEL">
+ <state id="MAIN_STATE">
+ <state id="1_PROPOSAL" initial="1_START">
+ <state id="1_START">
+ <onentry>
+ </onentry>
+ <transition event="event.role.system" target="SYSTEM_1.1_BEGIN"></transition>
+ <transition event="event.role.coordinator" target="COORDINATOR_1.1_BEGIN"></transition>
+ </state>
+ <state id="SYSTEM_1.1_ANNOUNCEMENT" initial="SYSTEM_1.1_BEGIN">
+ <state id="SYSTEM_1.1.2_REMINDER_COORDINATOR-PREPARE-INFO">
+ <onentry>
+ </onentry>
+ </state>
+ <state id="SYSTEM_1.1_BEGIN">
+ <onentry>
+
+ </onentry>
+ <transition cond="DATETIME_NOW == DATETIME_EVENT$REMINDER$1_PROPOSAL$ANNOUNCEMENT" event="event.datetime.reminder-2week-coordinator-prepare-info" target="SYSTEM_1.1.2_REMINDER_COORDINATOR-PREPARE-INFO"></transition>
+ </state>
+ </state>
+ <state id="COORDINATOR_1.1_ANNOUNCEMENT" initial="COORDINATOR_1.1_BEGIN">
+ <state id="COORDINATOR_1.1_BEGIN">
+ <onentry>
+
+ </onentry>
+ <transition event="FLAG_REMINDER1 == TRUE" target="COORDINATOR_1.1.1_ANNOUNCEMENT-CONTENTS-VALIDATE"></transition>
+ </state>
+ <state id="COORDINATOR_1.1.1_ANNOUNCEMENT-CONTENTS-VALIDATE"></state>
+ </state>
+ </state>
+ </state>
+ <state id="finish_shortcut">
+ <transition event="event.finish" target="finished"></transition>
+ </state>
+ <state id="ADMINISTRATIVE_TASKS">
+ <state id="ADMINISTRATIVE_NON-HR-MANAGEMENT">
+ <onentry>
+
+ </onentry>
+ <transition event="event.administrative.next" target="ADMINISTRATIVE_NON-HR-MANAGEMENT_2"></transition>
+ </state>
+ <state id="ADMINISTRATIVE_NON-HR-MANAGEMENT_2">
+ <onentry>
+
+ </onentry>
+ </state>
+ </state>
+ <state id="COORDINATOR_TASKS">
+ <state id="COORDINATOR_1"></state>
+ </state>
+ <state id="HR-MANAGER_TASKS">
+ <state id="HR-MANAGER_MANAGE-HR"></state>
+ </state>
+ </parallel>
+ <final id="finished"></final>
+</scxml>
diff --git a/test/src/test-initial-config.cpp b/test/src/test-initial-config.cpp
new file mode 100644
index 0000000..dcba84d
--- /dev/null
+++ b/test/src/test-initial-config.cpp
@@ -0,0 +1,36 @@
+#include "uscxml/Message.h"
+#include "uscxml/Interpreter.h"
+#include <assert.h>
+#include <boost/algorithm/string.hpp>
+#include <iostream>
+
+using namespace uscxml;
+using namespace boost;
+
+
+int main(int argc, char** argv) {
+#ifdef _WIN32
+ WSADATA wsaData;
+ WSAStartup(MAKEWORD(2, 2), &wsaData);
+#endif
+
+ if (argc != 2) {
+ std::cerr << "Expected path to test-initial-config.scxml" << std::endl;
+ exit(EXIT_FAILURE);
+ }
+
+ std::string test = argv[1];
+
+ {
+ Interpreter interpreter = Interpreter::fromURI(test);
+ std::vector<std::string> states;
+ states.push_back("finish_shortcut");
+ states.push_back("ADMINISTRATIVE_NON-HR-MANAGEMENT");
+ states.push_back("HR-MANAGER_MANAGE-HR");
+ states.push_back("SYSTEM_1.1_BEGIN");
+ states.push_back("COORDINATOR_1");
+ interpreter.setConfiguration(states);
+ interpreter.interpret();
+ }
+
+} \ No newline at end of file