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"
26 #include "ns3/priority-queue-scheduler.h"
34 virtual void DoRun (
void);
39 void Eventfoo0 (
void);
40 uint64_t NowUs (
void);
53 :
TestCase (
"Check that basic event handling is working with " +
54 schedulerFactory.GetTypeId ().GetName ()),
55 m_schedulerFactory (schedulerFactory)
74 if (b != 2 ||
NowUs () != 11)
82 Simulator::Remove (
m_idC);
96 if (d != 4 ||
NowUs () != (11 + 10))
134 Simulator::Cancel (a);
146 Simulator::Remove (anId);
168 Simulator::Destroy ();
184 virtual void DoRun (
void);
191 void bar4 (
int,
int,
int,
int) {}
192 void bar5 (
int,
int,
int,
int,
int) {}
195 void baz3 (
int &,
int &,
int &) {}
196 void baz4 (
int &,
int &,
int &,
int &) {}
197 void baz5 (
int &,
int &,
int &,
int &,
int &) {}
199 void cbaz2 (
const int &,
const int &) {}
200 void cbaz3 (
const int &,
const int &,
const int &) {}
201 void cbaz4 (
const int &,
const int &,
const int &,
const int &) {}
202 void cbaz5 (
const int &,
const int &,
const int &,
const int &,
const int &) {}
208 void bar4c (
int,
int,
int,
int)
const {}
209 void bar5c (
int,
int,
int,
int,
int)
const {}
212 void baz3c (
int &,
int &,
int &)
const {}
213 void baz4c (
int &,
int &,
int &,
int &)
const {}
214 void baz5c (
int &,
int &,
int &,
int &,
int &)
const {}
216 void cbaz2c (
const int &,
const int &)
const {}
217 void cbaz3c (
const int &,
const int &,
const int &)
const {}
218 void cbaz4c (
const int &,
const int &,
const int &,
const int &)
const {}
219 void cbaz5c (
const int &,
const int &,
const int &,
const int &,
const int &)
const {}
230 static void foo3 (
int,
int,
int)
232 static void foo4 (
int,
int,
int,
int)
234 static void foo5 (
int,
int,
int,
int,
int)
238 static void ber2 (
int &,
int &)
240 static void ber3 (
int &,
int &,
int &)
242 static void ber4 (
int &,
int &,
int &,
int &)
244 static void ber5 (
int &,
int &,
int &,
int &,
int &)
248 static void cber2 (
const int &,
const int &)
250 static void cber3 (
const int &,
const int &,
const int &)
252 static void cber4 (
const int &,
const int &,
const int &,
const int &)
254 static void cber5 (
const int &,
const int &,
const int &,
const int &,
const int &)
258 :
TestCase (
"Check that all templates are instantiated correctly. This is a compilation test, it cannot fail at runtime.")
338 Simulator::Schedule (
Seconds (0.0), &
foo3, 0, 0, 0);
339 Simulator::Schedule (
Seconds (0.0), &
foo4, 0, 0, 0, 0);
340 Simulator::Schedule (
Seconds (0.0), &
foo5, 0, 0, 0, 0, 0);
344 Simulator::Schedule (
Seconds (0.0), &
cber4, 0, 0, 0, 0);
345 Simulator::Schedule (
Seconds (0.0), &
cber5, 0, 0, 0, 0, 0);
346 Simulator::ScheduleNow (&
foo0);
347 Simulator::ScheduleNow (&
foo1, 0);
348 Simulator::ScheduleNow (&
foo2, 0, 0);
349 Simulator::ScheduleNow (&
foo3, 0, 0, 0);
350 Simulator::ScheduleNow (&
foo4, 0, 0, 0, 0);
351 Simulator::ScheduleNow (&
foo5, 0, 0, 0, 0, 0);
352 Simulator::ScheduleNow (&
cber1, 0);
353 Simulator::ScheduleNow (&
cber2, 0, 0);
354 Simulator::ScheduleNow (&
cber3, 0, 0, 0);
355 Simulator::ScheduleNow (&
cber4, 0, 0, 0, 0);
356 Simulator::ScheduleNow (&
cber5, 0, 0, 0, 0, 0);
357 Simulator::ScheduleDestroy (&
foo0);
358 Simulator::ScheduleDestroy (&
foo1, 0);
359 Simulator::ScheduleDestroy (&
foo2, 0, 0);
360 Simulator::ScheduleDestroy (&
foo3, 0, 0, 0);
361 Simulator::ScheduleDestroy (&
foo4, 0, 0, 0, 0);
362 Simulator::ScheduleDestroy (&
foo5, 0, 0, 0, 0, 0);
363 Simulator::ScheduleDestroy (&
cber1, 0);
364 Simulator::ScheduleDestroy (&
cber2, 0, 0);
365 Simulator::ScheduleDestroy (&
cber3, 0, 0, 0);
366 Simulator::ScheduleDestroy (&
cber4, 0, 0, 0, 0);
367 Simulator::ScheduleDestroy (&
cber5, 0, 0, 0, 0, 0);
434 Simulator::Schedule (
Seconds (0.0), &
ber3, 0, 0, 0);
435 Simulator::Schedule (
Seconds (0.0), &
ber4, 0, 0, 0, 0);
436 Simulator::Schedule (
Seconds (0.0), &
ber5, 0, 0, 0, 0, 0);
442 Simulator::ScheduleNow (&
ber1, 0);
443 Simulator::ScheduleNow (&
ber2, 0, 0);
444 Simulator::ScheduleNow (&
ber3, 0, 0, 0);
445 Simulator::ScheduleNow (&
ber4, 0, 0, 0, 0);
446 Simulator::ScheduleNow (&
ber5, 0, 0, 0, 0, 0);
452 Simulator::ScheduleDestroy (&
ber1, 0);
453 Simulator::ScheduleDestroy (&
ber2, 0, 0);
454 Simulator::ScheduleDestroy (&
ber3, 0, 0, 0);
455 Simulator::ScheduleDestroy (&
ber4, 0, 0, 0, 0);
456 Simulator::ScheduleDestroy (&
ber5, 0, 0, 0, 0, 0);
465 Simulator::Destroy ();
475 factory.
SetTypeId (ListScheduler::GetTypeId ());
478 factory.
SetTypeId (MapScheduler::GetTypeId ());
480 factory.
SetTypeId (HeapScheduler::GetTypeId ());
482 factory.
SetTypeId (CalendarScheduler::GetTypeId ());
484 factory.
SetTypeId (PriorityQueueScheduler::GetTypeId ());
virtual void DoRun(void)
Implementation to actually run this TestCase.
SimulatorEventsTestCase(ObjectFactory schedulerFactory)
ObjectFactory m_schedulerFactory
void bar4(int, int, int, int)
void cbaz2(const int &, const int &)
void baz5c(int &, int &, int &, int &, int &) const
void cbaz4c(const int &, const int &, const int &, const int &) const
virtual void DoRun(void)
Implementation to actually run this TestCase.
void baz3c(int &, int &, int &) const
void baz4c(int &, int &, int &, int &) const
void cbaz2c(const int &, const int &) const
void baz4(int &, int &, int &, int &)
void cbaz5c(const int &, const int &, const int &, const int &, const int &) const
SimulatorTemplateTestCase()
void cbaz5(const int &, const int &, const int &, const int &, const int &)
void bar5(int, int, int, int, int)
void baz2c(int &, int &) const
void baz5(int &, int &, int &, int &, int &)
void cbaz3(const int &, const int &, const int &)
void bar4c(int, int, int, int) const
void bar3c(int, int, int) const
void cbaz3c(const int &, const int &, const int &) const
void cbaz1c(const int &) const
void cbaz4(const int &, const int &, const int &, const int &)
void bar5c(int, int, int, int, int) const
void bar2c(int, int) const
void baz3(int &, int &, int &)
An identifier for simulation events.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Instantiate subclasses of ns3::Object.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_UNUSED(x)
Mark a local variable as unused.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static void ber5(int &, int &, int &, int &, int &)
static void foo3(int, int, int)
static void ber4(int &, int &, int &, int &)
static void cber5(const int &, const int &, const int &, const int &, const int &)
static void cber1(const int &)
static void ber3(int &, int &, int &)
SimulatorTestSuite g_simulatorTestSuite
static void cber3(const int &, const int &, const int &)
static void foo4(int, int, int, int)
static void foo2(int, int)
static void cber2(const int &, const int &)
static void cber4(const int &, const int &, const int &, const int &)
static void foo5(int, int, int, int, int)
static void ber2(int &, int &)