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"
54 virtual void DoRun (
void);
60 void EventA (
int value);
61 void EventB (
int value);
62 void EventC (
int value);
63 void EventD (
int value);
69 void Eventfoo0 (
void);
75 uint64_t NowUs (
void);
97 :
TestCase (
"Check that basic event handling is working with " +
98 schedulerFactory.GetTypeId ().GetName ()),
99 m_schedulerFactory (schedulerFactory)
117 if (b != 2 ||
NowUs () != 11)
125 Simulator::Remove (
m_idC);
138 if (d != 4 ||
NowUs () != (11 + 10))
176 Simulator::Cancel (a);
188 Simulator::Remove (anId);
210 Simulator::Destroy ();
237 virtual void DoRun (
void);
249 void bar4 (
int,
int,
int,
int) {}
250 void bar5 (
int,
int,
int,
int,
int) {}
253 void baz3 (
int &,
int &,
int &) {}
254 void baz4 (
int &,
int &,
int &,
int &) {}
255 void baz5 (
int &,
int &,
int &,
int &,
int &) {}
257 void cbaz2 (
const int &,
const int &) {}
258 void cbaz3 (
const int &,
const int &,
const int &) {}
259 void cbaz4 (
const int &,
const int &,
const int &,
const int &) {}
260 void cbaz5 (
const int &,
const int &,
const int &,
const int &,
const int &) {}
266 void bar4c (
int,
int,
int,
int)
const {}
267 void bar5c (
int,
int,
int,
int,
int)
const {}
270 void baz3c (
int &,
int &,
int &)
const {}
271 void baz4c (
int &,
int &,
int &,
int &)
const {}
272 void baz5c (
int &,
int &,
int &,
int &,
int &)
const {}
274 void cbaz2c (
const int &,
const int &)
const {}
275 void cbaz3c (
const int &,
const int &,
const int &)
const {}
276 void cbaz4c (
const int &,
const int &,
const int &,
const int &)
const {}
277 void cbaz5c (
const int &,
const int &,
const int &,
const int &,
const int &)
const {}
294 static void foo3 (
int,
int,
int)
296 static void foo4 (
int,
int,
int,
int)
298 static void foo5 (
int,
int,
int,
int,
int)
302 static void ber2 (
int &,
int &)
304 static void ber3 (
int &,
int &,
int &)
306 static void ber4 (
int &,
int &,
int &,
int &)
308 static void ber5 (
int &,
int &,
int &,
int &,
int &)
312 static void cber2 (
const int &,
const int &)
314 static void cber3 (
const int &,
const int &,
const int &)
316 static void cber4 (
const int &,
const int &,
const int &,
const int &)
318 static void cber5 (
const int &,
const int &,
const int &,
const int &,
const int &)
323 :
TestCase (
"Check that all templates are instantiated correctly. This is a compilation test, it cannot fail at runtime.")
403 Simulator::Schedule (
Seconds (0.0), &
foo3, 0, 0, 0);
404 Simulator::Schedule (
Seconds (0.0), &
foo4, 0, 0, 0, 0);
405 Simulator::Schedule (
Seconds (0.0), &
foo5, 0, 0, 0, 0, 0);
409 Simulator::Schedule (
Seconds (0.0), &
cber4, 0, 0, 0, 0);
410 Simulator::Schedule (
Seconds (0.0), &
cber5, 0, 0, 0, 0, 0);
411 Simulator::ScheduleNow (&
foo0);
412 Simulator::ScheduleNow (&
foo1, 0);
413 Simulator::ScheduleNow (&
foo2, 0, 0);
414 Simulator::ScheduleNow (&
foo3, 0, 0, 0);
415 Simulator::ScheduleNow (&
foo4, 0, 0, 0, 0);
416 Simulator::ScheduleNow (&
foo5, 0, 0, 0, 0, 0);
417 Simulator::ScheduleNow (&
cber1, 0);
418 Simulator::ScheduleNow (&
cber2, 0, 0);
419 Simulator::ScheduleNow (&
cber3, 0, 0, 0);
420 Simulator::ScheduleNow (&
cber4, 0, 0, 0, 0);
421 Simulator::ScheduleNow (&
cber5, 0, 0, 0, 0, 0);
422 Simulator::ScheduleDestroy (&
foo0);
423 Simulator::ScheduleDestroy (&
foo1, 0);
424 Simulator::ScheduleDestroy (&
foo2, 0, 0);
425 Simulator::ScheduleDestroy (&
foo3, 0, 0, 0);
426 Simulator::ScheduleDestroy (&
foo4, 0, 0, 0, 0);
427 Simulator::ScheduleDestroy (&
foo5, 0, 0, 0, 0, 0);
428 Simulator::ScheduleDestroy (&
cber1, 0);
429 Simulator::ScheduleDestroy (&
cber2, 0, 0);
430 Simulator::ScheduleDestroy (&
cber3, 0, 0, 0);
431 Simulator::ScheduleDestroy (&
cber4, 0, 0, 0, 0);
432 Simulator::ScheduleDestroy (&
cber5, 0, 0, 0, 0, 0);
499 Simulator::Schedule (
Seconds (0.0), &
ber3, 0, 0, 0);
500 Simulator::Schedule (
Seconds (0.0), &
ber4, 0, 0, 0, 0);
501 Simulator::Schedule (
Seconds (0.0), &
ber5, 0, 0, 0, 0, 0);
507 Simulator::ScheduleNow (&
ber1, 0);
508 Simulator::ScheduleNow (&
ber2, 0, 0);
509 Simulator::ScheduleNow (&
ber3, 0, 0, 0);
510 Simulator::ScheduleNow (&
ber4, 0, 0, 0, 0);
511 Simulator::ScheduleNow (&
ber5, 0, 0, 0, 0, 0);
517 Simulator::ScheduleDestroy (&
ber1, 0);
518 Simulator::ScheduleDestroy (&
ber2, 0, 0);
519 Simulator::ScheduleDestroy (&
ber3, 0, 0, 0);
520 Simulator::ScheduleDestroy (&
ber4, 0, 0, 0, 0);
521 Simulator::ScheduleDestroy (&
ber5, 0, 0, 0, 0, 0);
530 Simulator::Destroy ();
546 factory.
SetTypeId (ListScheduler::GetTypeId ());
549 factory.
SetTypeId (MapScheduler::GetTypeId ());
551 factory.
SetTypeId (HeapScheduler::GetTypeId ());
553 factory.
SetTypeId (CalendarScheduler::GetTypeId ());
555 factory.
SetTypeId (PriorityQueueScheduler::GetTypeId ());
Check that basic event handling is working with different Simulator implementations.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void EventD(int value)
Test Event.
void EventC(int value)
Test Event.
bool m_c
Checks that events are properly handled.
SimulatorEventsTestCase(ObjectFactory schedulerFactory)
Constructor.
uint64_t NowUs(void)
Get the simulator time.
bool m_a
Checks that events are properly handled.
bool m_destroy
Checks that events are properly handled.
bool m_b
Checks that events are properly handled.
void Eventfoo0(void)
Test Event.
void EventB(int value)
Test Event.
ObjectFactory m_schedulerFactory
Scheduler factory.
EventId m_destroyId
Event to check event lifetime.
void Destroy(void)
Checks that the events has been detroyed.
void EventA(int value)
Test Event.
bool m_d
Checks that events are properly handled.
Check that all templates are instantiated correctly.
void bar2(int, int)
Function used for scheduling.
void bar4(int, int, int, int)
Function used for scheduling.
void bar1c(int) const
Function used for scheduling.
void cbaz2(const int &, const int &)
Function used for scheduling.
void Ref(void) const
Ref and Unref - only here for testing of Ptr<>
void baz5c(int &, int &, int &, int &, int &) const
Function used for scheduling.
void baz1(int &)
Function used for scheduling.
void Unref(void) const
Ref and Unref - only here for testing of Ptr<>
void cbaz4c(const int &, const int &, const int &, const int &) const
Function used for scheduling.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void baz3c(int &, int &, int &) const
Function used for scheduling.
void baz4c(int &, int &, int &, int &) const
Function used for scheduling.
void cbaz2c(const int &, const int &) const
Function used for scheduling.
void baz4(int &, int &, int &, int &)
Function used for scheduling.
void baz1c(int &) const
Function used for scheduling.
void cbaz5c(const int &, const int &, const int &, const int &, const int &) const
Function used for scheduling.
SimulatorTemplateTestCase()
void cbaz5(const int &, const int &, const int &, const int &, const int &)
Function used for scheduling.
void bar5(int, int, int, int, int)
Function used for scheduling.
void baz2c(int &, int &) const
Function used for scheduling.
void baz5(int &, int &, int &, int &, int &)
Function used for scheduling.
void bar0(void)
Function used for scheduling.
void bar0c(void) const
Function used for scheduling.
void bar1(int)
Function used for scheduling.
void cbaz1(const int &)
Function used for scheduling.
void cbaz3(const int &, const int &, const int &)
Function used for scheduling.
void bar4c(int, int, int, int) const
Function used for scheduling.
void bar3c(int, int, int) const
Function used for scheduling.
void cbaz3c(const int &, const int &, const int &) const
Function used for scheduling.
void cbaz1c(const int &) const
Function used for scheduling.
void cbaz4(const int &, const int &, const int &, const int &)
Function used for scheduling.
void baz2(int &, int &)
Function used for scheduling.
void bar5c(int, int, int, int, int) const
Function used for scheduling.
void bar2c(int, int) const
Function used for scheduling.
void bar3(int, int, int)
Function used for scheduling.
void baz3(int &, int &, int &)
Function used for scheduling.
The simulator Test Suite.
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.
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 &)
Function used for scheduling.
static void foo3(int, int, int)
Function used for scheduling.
static void ber4(int &, int &, int &, int &)
Function used for scheduling.
static void cber5(const int &, const int &, const int &, const int &, const int &)
Function used for scheduling.
static void cber1(const int &)
Function used for scheduling.
static void ber3(int &, int &, int &)
Function used for scheduling.
static SimulatorTestSuite g_simulatorTestSuite
Static variable for test initialization.
static void cber3(const int &, const int &, const int &)
Function used for scheduling.
static void foo4(int, int, int, int)
Function used for scheduling.
static void foo2(int, int)
Function used for scheduling.
static void cber2(const int &, const int &)
Function used for scheduling.
static void cber4(const int &, const int &, const int &, const int &)
Function used for scheduling.
static void ber1(int &)
Function used for scheduling.
static void foo5(int, int, int, int, int)
Function used for scheduling.
static void foo1(int)
Function used for scheduling.
static void ber2(int &, int &)
Function used for scheduling.
static void foo0(void)
Function used for scheduling.