test each default event scheduler
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 02 Oct 2006 19:10:04 +0200
changeset 114 fe0504af6d16
parent 113 3c09b55983d9
child 115 5435512761ef
test each default event scheduler
src/simulator/simulator.cc
--- a/src/simulator/simulator.cc	Mon Oct 02 14:45:43 2006 +0200
+++ b/src/simulator/simulator.cc	Mon Oct 02 19:10:04 2006 +0200
@@ -396,6 +396,7 @@
     virtual ~SimulatorTests ();
     virtual bool runTests (void);
 private:
+    bool runOneTest (void);
     void a (int a);
     void b (int b);
     void c (int c);
@@ -442,14 +443,15 @@
         m_d = true;
     }
 }
-bool 
-SimulatorTests::runTests (void)
+bool
+SimulatorTests::runOneTest (void)
 {
     bool ok = true;
     m_a = true;
     m_b = false;
     m_c = true;
     m_d = false;
+
     EventId a = Simulator::schedule (Time::absUs (10), &SimulatorTests::a, this, 1);
     EventId b = Simulator::schedule (Time::absUs (11), &SimulatorTests::b, this, 2);
     m_idC = Simulator::schedule (Time::absUs (12), &SimulatorTests::c, this, 3);
@@ -460,6 +462,28 @@
     if (!m_a || !m_b || !m_c || !m_d) {
         ok = false;
     }
+    return ok;
+}
+bool 
+SimulatorTests::runTests (void)
+{
+    bool ok = true;
+
+    Simulator::setLinkedList ();
+    if (!runOneTest ()) {
+        ok = false;
+    }
+    Simulator::destroy ();
+    Simulator::setBinaryHeap ();
+    if (!runOneTest ()) {
+        ok = false;
+    }
+    Simulator::destroy ();
+    Simulator::setStdMap ();
+    if (!runOneTest ()) {
+        ok = false;
+    }
+    Simulator::destroy ();
 
     return ok;
 }