summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-09-16 23:20:57 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-09-16 23:20:57 (GMT)
commit64cc2ce105cf57fcba637b309664b4bc74ae7d82 (patch)
tree118786a131b9a7b947c0f6b7a319e5031d396b6c
parent959224050cbceb024588bf0b49c57c503c299beb (diff)
downloaduscxml-64cc2ce105cf57fcba637b309664b4bc74ae7d82.zip
uscxml-64cc2ce105cf57fcba637b309664b4bc74ae7d82.tar.gz
uscxml-64cc2ce105cf57fcba637b309664b4bc74ae7d82.tar.bz2
Fixed all tests
-rw-r--r--src/uscxml/Interpreter.h3
-rw-r--r--test/CMakeLists.txt6
-rw-r--r--test/src/test-communication.cpp10
-rw-r--r--test/src/test-communication.scxml2
-rw-r--r--test/src/test-ecmascript-v8.cpp5
-rw-r--r--test/src/test-eventdelay.cpp4
6 files changed, 17 insertions, 13 deletions
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index cad8ee8..4a948dc 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -39,7 +39,8 @@ namespace uscxml {
void start();
static void run(void*);
-
+ void join() { if (_thread != NULL) _thread->join(); };
+
void interpret();
bool validate();
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0abcafa..1fdaaee 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -20,15 +20,15 @@ set_target_properties(test-ecmascript-v8 PROPERTIES FOLDER "Tests")
add_executable(test-communication src/test-communication.cpp)
target_link_libraries(test-communication uscxml)
-add_test(test-communication test-communication)
+add_test(test-communication ${CURRENT_BINARY_DIR}/test-communication ${CMAKE_SOURCE_DIR}/test/src/test-communication.scxml)
set_target_properties(test-communication PROPERTIES FOLDER "Tests")
add_executable(test-eventdelay src/test-eventdelay.cpp)
target_link_libraries(test-eventdelay uscxml)
-add_test(test-eventdelay test-eventdelay)
+add_test(test-eventdelay ${CURRENT_BINARY_DIR}/test-eventdelay)
set_target_properties(test-eventdelay PROPERTIES FOLDER "Tests")
add_executable(test-completion src/test-completion.cpp)
target_link_libraries(test-completion uscxml)
-add_test(test-completion ${CMAKE_SOURCE_DIR}/test/src/test-donedata.scxml)
+add_test(test-completion ${CURRENT_BINARY_DIR}/test-completion ${CMAKE_SOURCE_DIR}/test/src/test-donedata.scxml)
set_target_properties(test-completion PROPERTIES FOLDER "Tests")
diff --git a/test/src/test-communication.cpp b/test/src/test-communication.cpp
index a3c2428..ac0fa6c 100644
--- a/test/src/test-communication.cpp
+++ b/test/src/test-communication.cpp
@@ -16,12 +16,16 @@ int main(int argc, char** argv) {
// e.compound["foo2"] = Data("bar2", Data::VERBATIM);
// std::cout << e.toDocument() << std::endl;
- for (int i = 0; i < 1; i++) {
+ int nrInterpreters = 1;
+ for (int i = 0; i < nrInterpreters; i++) {
_interpreters.push_back(Interpreter::fromURI(argv[1]));
_interpreters.back()->start();
}
- while(true)
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(1000000));
+ std::list<Interpreter*>::iterator interIter = _interpreters.begin();
+ while(interIter != _interpreters.end()) {
+ (*interIter)->join();
+ interIter++;
+ }
} \ No newline at end of file
diff --git a/test/src/test-communication.scxml b/test/src/test-communication.scxml
index c1c1f65..610f8cc 100644
--- a/test/src/test-communication.scxml
+++ b/test/src/test-communication.scxml
@@ -43,7 +43,7 @@ This is some content you got there dude!
<log expr="'Calling finalize on returned event'" />
</finalize>
</invoke>
- <transition event="transitionToNext" target="step2" />
+ <transition event="transitionToNext" target="final" />
</state>
<final id="final">
<onentry>
diff --git a/test/src/test-ecmascript-v8.cpp b/test/src/test-ecmascript-v8.cpp
index d11fc61..9e7635b 100644
--- a/test/src/test-ecmascript-v8.cpp
+++ b/test/src/test-ecmascript-v8.cpp
@@ -18,8 +18,7 @@ int main(int argc, char** argv) {
Event event1;
event1.name = "event1";
scxml->receive(event1);
- scxml->waitForStabilization();
- while(true)
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(200));
+ scxml->join();
+ tthread::this_thread::sleep_for(tthread::chrono::milliseconds(500));
} \ No newline at end of file
diff --git a/test/src/test-eventdelay.cpp b/test/src/test-eventdelay.cpp
index 6a28e44..45a14b7 100644
--- a/test/src/test-eventdelay.cpp
+++ b/test/src/test-eventdelay.cpp
@@ -26,7 +26,7 @@ int main(int argc, char** argv) {
// eq->addEvent("bar", callback, 300, (void*)"event bar");
// eq->addEvent("baz", callback, 400, (void*)"event baz");
- for (unsigned int i = 0; i <= 5000; i += 500) {
+ for (unsigned int i = 0; i <= 2000; i += 200) {
// eq->stop();
std::stringstream ss;
ss << i;
@@ -34,6 +34,6 @@ int main(int argc, char** argv) {
std::cout << "Added " << i << std::endl;
// eq->start();
}
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(20000));
+ tthread::this_thread::sleep_for(tthread::chrono::milliseconds(2000));
} \ No newline at end of file