21 #include "ns3/simulator.h"
22 #include "ns3/list-scheduler.h"
23 #include "ns3/heap-scheduler.h"
24 #include "ns3/map-scheduler.h"
25 #include "ns3/calendar-scheduler.h"
33 virtual void DoRun (
void);
39 uint64_t NowUs (
void);
52 :
TestCase (
"Check that basic event handling is working with " +
53 schedulerFactory.GetTypeId ().GetName ()),
54 m_schedulerFactory (schedulerFactory)
73 if (b != 2 ||
NowUs () != 11)
81 Simulator::Remove (
m_idC);
94 if (d != 4 ||
NowUs () != (11+10))
132 Simulator::Cancel (a);
144 Simulator::Remove (anId);
156 Simulator::Remove (m_destroyId);
157 NS_TEST_EXPECT_MSG_EQ (m_destroyId.IsExpired (),
true,
"Event was canceled: should have expired now");
166 Simulator::Destroy ();
179 virtual void DoRun (
void);
185 void bar4 (
int,
int,
int,
int) {}
186 void bar5 (
int,
int,
int,
int,
int) {}
189 void baz3 (
int &,
int &,
int &) {}
190 void baz4 (
int &,
int &,
int &,
int &) {}
191 void baz5 (
int &,
int &,
int &,
int &,
int &) {}
193 void cbaz2 (
const int &,
const int &) {}
194 void cbaz3 (
const int &,
const int &,
const int &) {}
195 void cbaz4 (
const int &,
const int &,
const int &,
const int &) {}
196 void cbaz5 (
const int &,
const int &,
const int &,
const int &,
const int &) {}
202 void bar4c (
int,
int,
int,
int)
const {}
203 void bar5c (
int,
int,
int,
int,
int)
const {}
206 void baz3c (
int &,
int &,
int &)
const {}
207 void baz4c (
int &,
int &,
int &,
int &)
const {}
208 void baz5c (
int &,
int &,
int &,
int &,
int &)
const {}
210 void cbaz2c (
const int &,
const int &)
const {}
211 void cbaz3c (
const int &,
const int &,
const int &)
const {}
212 void cbaz4c (
const int &,
const int &,
const int &,
const int &)
const {}
213 void cbaz5c (
const int &,
const int &,
const int &,
const int &,
const int &)
const {}
223 static void foo3 (
int,
int,
int)
225 static void foo4 (
int,
int,
int,
int)
227 static void foo5 (
int,
int,
int,
int,
int)
231 static void ber2 (
int &,
int &)
233 static void ber3 (
int &,
int &,
int &)
235 static void ber4 (
int &,
int &,
int &,
int &)
237 static void ber5 (
int &,
int &,
int &,
int &,
int &)
241 static void cber2 (
const int &,
const int &)
243 static void cber3 (
const int &,
const int &,
const int &)
245 static void cber4 (
const int &,
const int &,
const int &,
const int &)
247 static void cber5 (
const int &,
const int &,
const int &,
const int &,
const int &)
251 :
TestCase (
"Check that all templates are instanciated correctly. This is a compilation test, it cannot fail at runtime.")
329 Simulator::Schedule (Seconds (0.0), &
foo0);
330 Simulator::Schedule (Seconds (0.0), &
foo1, 0);
331 Simulator::Schedule (Seconds (0.0), &
foo2, 0, 0);
332 Simulator::Schedule (Seconds (0.0), &
foo3, 0, 0, 0);
333 Simulator::Schedule (Seconds (0.0), &
foo4, 0, 0, 0, 0);
334 Simulator::Schedule (Seconds (0.0), &
foo5, 0, 0, 0, 0, 0);
335 Simulator::Schedule (Seconds (0.0), &
cber1, 0);
336 Simulator::Schedule (Seconds (0.0), &
cber2, 0, 0);
337 Simulator::Schedule (Seconds (0.0), &
cber3, 0, 0, 0);
338 Simulator::Schedule (Seconds (0.0), &
cber4, 0, 0, 0, 0);
339 Simulator::Schedule (Seconds (0.0), &
cber5, 0, 0, 0, 0, 0);
340 Simulator::ScheduleNow (&
foo0);
341 Simulator::ScheduleNow (&
foo1, 0);
342 Simulator::ScheduleNow (&
foo2, 0, 0);
343 Simulator::ScheduleNow (&
foo3, 0, 0, 0);
344 Simulator::ScheduleNow (&
foo4, 0, 0, 0, 0);
345 Simulator::ScheduleNow (&
foo5, 0, 0, 0, 0, 0);
346 Simulator::ScheduleNow (&
cber1, 0);
347 Simulator::ScheduleNow (&
cber2, 0, 0);
348 Simulator::ScheduleNow (&
cber3, 0, 0, 0);
349 Simulator::ScheduleNow (&
cber4, 0, 0, 0, 0);
350 Simulator::ScheduleNow (&
cber5, 0, 0, 0, 0, 0);
351 Simulator::ScheduleDestroy (&
foo0);
352 Simulator::ScheduleDestroy (&
foo1, 0);
353 Simulator::ScheduleDestroy (&
foo2, 0, 0);
354 Simulator::ScheduleDestroy (&
foo3, 0, 0, 0);
355 Simulator::ScheduleDestroy (&
foo4, 0, 0, 0, 0);
356 Simulator::ScheduleDestroy (&
foo5, 0, 0, 0, 0, 0);
357 Simulator::ScheduleDestroy (&
cber1, 0);
358 Simulator::ScheduleDestroy (&
cber2, 0, 0);
359 Simulator::ScheduleDestroy (&
cber3, 0, 0, 0);
360 Simulator::ScheduleDestroy (&
cber4, 0, 0, 0, 0);
361 Simulator::ScheduleDestroy (&
cber5, 0, 0, 0, 0, 0);
426 Simulator::Schedule (Seconds (0.0), &
ber1, 0);
427 Simulator::Schedule (Seconds (0.0), &
ber2, 0, 0);
428 Simulator::Schedule (Seconds (0.0), &
ber3, 0, 0, 0);
429 Simulator::Schedule (Seconds (0.0), &
ber4, 0, 0, 0, 0);
430 Simulator::Schedule (Seconds (0.0), &
ber5, 0, 0, 0, 0, 0);
436 Simulator::ScheduleNow (&
ber1, 0);
437 Simulator::ScheduleNow (&
ber2, 0, 0);
438 Simulator::ScheduleNow (&
ber3, 0, 0, 0);
439 Simulator::ScheduleNow (&
ber4, 0, 0, 0, 0);
440 Simulator::ScheduleNow (&
ber5, 0, 0, 0, 0, 0);
446 Simulator::ScheduleDestroy (&
ber1, 0);
447 Simulator::ScheduleDestroy (&
ber2, 0, 0);
448 Simulator::ScheduleDestroy (&
ber3, 0, 0, 0);
449 Simulator::ScheduleDestroy (&
ber4, 0, 0, 0, 0);
450 Simulator::ScheduleDestroy (&
ber5, 0, 0, 0, 0, 0);
459 Simulator::Destroy ();
469 factory.
SetTypeId (ListScheduler::GetTypeId ());
472 factory.
SetTypeId (MapScheduler::GetTypeId ());
474 factory.
SetTypeId (HeapScheduler::GetTypeId ());
476 factory.
SetTypeId (CalendarScheduler::GetTypeId ());