more tests

This commit is contained in:
Mathieu Lacage
2006-09-03 15:17:01 +02:00
parent aac8571003
commit 67064f85dc

View File

@@ -366,9 +366,11 @@ private:
void a (int a); void a (int a);
void b (int b); void b (int b);
void c (int c); void c (int c);
void d (int d);
bool m_b; bool m_b;
bool m_a; bool m_a;
bool m_c; bool m_c;
bool m_d;
EventId m_id_c; EventId m_id_c;
}; };
@@ -391,12 +393,22 @@ SimulatorTests::b (int b)
m_b = true; m_b = true;
} }
Simulator::remove (m_id_c); Simulator::remove (m_id_c);
Simulator::schedule (RelTimeUs (10), &SimulatorTests::d, this, 4);
} }
void void
SimulatorTests::c (int c) SimulatorTests::c (int c)
{ {
m_c = false; m_c = false;
} }
void
SimulatorTests::d (int d)
{
if (d != 4) {
m_d = false;
} else {
m_d = true;
}
}
bool bool
SimulatorTests::run_tests (void) SimulatorTests::run_tests (void)
{ {
@@ -404,6 +416,7 @@ SimulatorTests::run_tests (void)
m_a = true; m_a = true;
m_b = false; m_b = false;
m_c = true; m_c = true;
m_d = false;
EventId a = Simulator::schedule (AbsTimeUs (10), &SimulatorTests::a, this, 1); EventId a = Simulator::schedule (AbsTimeUs (10), &SimulatorTests::a, this, 1);
EventId b = Simulator::schedule (AbsTimeUs (11), &SimulatorTests::b, this, 2); EventId b = Simulator::schedule (AbsTimeUs (11), &SimulatorTests::b, this, 2);
m_id_c = Simulator::schedule (AbsTimeUs (12), &SimulatorTests::c, this, 3); m_id_c = Simulator::schedule (AbsTimeUs (12), &SimulatorTests::c, this, 3);
@@ -411,7 +424,7 @@ SimulatorTests::run_tests (void)
Simulator::cancel (a); Simulator::cancel (a);
Simulator::run (); Simulator::run ();
if (!m_a || !m_b || !m_c) { if (!m_a || !m_b || !m_c || !m_d) {
ok = false; ok = false;
} }