Dummy step (delay 0)
[anna.git] / example / diameter / launcher / testing / TestStep.cpp
index cb1b0f9..524e0bd 100644 (file)
@@ -483,12 +483,13 @@ throw() {
   anna::xml::Node* result = TestStep::asXML(parent);
   //parent->createChild("TestStepDelay");
 
-  result->createAttribute("Delay", a_delay.asString());
+  result->createAttribute("Delay", ((a_delay == 0) ? "dummy step, no delay" : a_delay.asString()));
 
   return result;
 }
 
 bool TestStepDelay::do_execute() throw() {
+  if (a_delay == 0) { complete(); return true; } // special case
   try {
     a_timer = TestManager::instantiate().createTimer((TestCaseStep*)this, a_delay, TestTimer::Type::Delay);
   }
@@ -502,12 +503,14 @@ bool TestStepDelay::do_execute() throw() {
 }
 
 void TestStepDelay::do_complete() throw() {
+  if (a_delay == 0) return; // special case
   a_timer = NULL;
   next(); // next() invoked here because execute() is always false for delay and never advance the iterator
   // TODO, avoid this recursion
 }
 
 void TestStepDelay::do_reset() throw() {
+  if (a_delay == 0) return; // special case
   try {
     TestManager::instantiate().cancelTimer(a_timer);
   }