Add new operation 'run' to test a specific test case
[anna.git] / source / testing / TestManager.cpp
index 20a29a2..a74ab6d 100644 (file)
@@ -194,7 +194,7 @@ throw() {
 
 bool TestManager::configureTTPS(int testTicksPerSecond) throw() {
 
-  if (testTicksPerSecond  == 0) {
+  if (testTicksPerSecond == 0) {
     if (a_clock) {
       a_timeController->cancel(a_clock);
       LOGDEBUG(anna::Logger::debug("Testing timer clock stopped !", ANNA_FILE_LOCATION));
@@ -260,6 +260,23 @@ bool TestManager::gotoTestCase(unsigned int id) throw() {
   return false;
 }
 
+bool TestManager::runTestCase(unsigned int id) throw() {
+  test_pool_it it = a_testPool.find(id);
+  if (it != a_testPool.end()) {
+    a_currentTestIt = it;
+
+    // execTestCases will get the next one, we must return 1 position:
+    if (a_currentTestIt == a_testPool.begin())
+      a_currentTestIt = a_testPool.end();
+    else
+      a_currentTestIt--;
+
+    return execTestCases(1);
+  }
+
+  return false;
+}
+
 TestCase *TestManager::findTestCase(unsigned int id) const throw() { // id = -1 provides current test case triggered
 
   if (!tests()) return NULL;