19 #include "ns3/calendar-scheduler.h"
20 #include "ns3/heap-scheduler.h"
21 #include "ns3/list-scheduler.h"
22 #include "ns3/map-scheduler.h"
23 #include "ns3/priority-queue-scheduler.h"
24 #include "ns3/simulator.h"
53 void DoRun()
override;
59 void EventA(
int value);
60 void EventB(
int value);
61 void EventC(
int value);
62 void EventD(
int value);
96 :
TestCase(
"Check that basic event handling is working with " +
97 schedulerFactory.GetTypeId().GetName()),
98 m_schedulerFactory(schedulerFactory)
119 Simulator::Remove(
m_idC);
132 m_d = !(d != 4 ||
NowUs() != (11 + 10));
165 Simulator::Cancel(a);
181 "Event should not have expired yet.");
183 Simulator::Remove(anId);
193 "Event was canceled: should have expired now");
200 "Event was canceled: should have expired now");
209 Simulator::Destroy();
235 void DoRun()
override;
246 void bar4(
int,
int,
int,
int){};
247 void bar5(
int,
int,
int,
int,
int){};
251 void baz4(
int&,
int&,
int&,
int&){};
252 void baz5(
int&,
int&,
int&,
int&,
int&){};
254 void cbaz2(
const int&,
const int&){};
255 void cbaz3(
const int&,
const int&,
const int&){};
256 void cbaz4(
const int&,
const int&,
const int&,
const int&){};
257 void cbaz5(
const int&,
const int&,
const int&,
const int&,
const int&){};
263 void bar4c(
int,
int,
int,
int)
const {};
264 void bar5c(
int,
int,
int,
int,
int)
const {};
267 void baz3c(
int&,
int&,
int&)
const {};
268 void baz4c(
int&,
int&,
int&,
int&)
const {};
269 void baz5c(
int&,
int&,
int&,
int&,
int&)
const {};
271 void cbaz2c(
const int&,
const int&)
const {};
272 void cbaz3c(
const int&,
const int&,
const int&)
const {};
273 void cbaz4c(
const int&,
const int&,
const int&,
const int&)
const {};
274 void cbaz5c(
const int&,
const int&,
const int&,
const int&,
const int&)
const {};
334 ber5(
int&,
int&,
int&,
int&,
int&)
349 cber3(
const int&,
const int&,
const int&)
354 cber4(
const int&,
const int&,
const int&,
const int&)
359 cber5(
const int&,
const int&,
const int&,
const int&,
const int&)
366 :
TestCase(
"Check that all templates are instantiated correctly. This is a compilation test, "
367 "it cannot fail at runtime.")
425 Simulator::Schedule(
Seconds(0.0),
428 Simulator::Schedule(
Seconds(0.0),
432 Simulator::Schedule(
Seconds(0.0),
437 Simulator::Schedule(
Seconds(0.0),
443 Simulator::Schedule(
Seconds(0.0),
450 Simulator::Schedule(
Seconds(0.0),
518 Simulator::Schedule(
Seconds(0.0), &
foo4, 0, 0, 0, 0);
519 Simulator::Schedule(
Seconds(0.0), &
foo5, 0, 0, 0, 0, 0);
524 Simulator::Schedule(
Seconds(0.0), &
cber5, 0, 0, 0, 0, 0);
525 Simulator::ScheduleNow(&
foo0);
526 Simulator::ScheduleNow(&
foo1, 0);
527 Simulator::ScheduleNow(&
foo2, 0, 0);
528 Simulator::ScheduleNow(&
foo3, 0, 0, 0);
529 Simulator::ScheduleNow(&
foo4, 0, 0, 0, 0);
530 Simulator::ScheduleNow(&
foo5, 0, 0, 0, 0, 0);
531 Simulator::ScheduleNow(&
cber1, 0);
532 Simulator::ScheduleNow(&
cber2, 0, 0);
533 Simulator::ScheduleNow(&
cber3, 0, 0, 0);
534 Simulator::ScheduleNow(&
cber4, 0, 0, 0, 0);
535 Simulator::ScheduleNow(&
cber5, 0, 0, 0, 0, 0);
536 Simulator::ScheduleDestroy(&
foo0);
537 Simulator::ScheduleDestroy(&
foo1, 0);
538 Simulator::ScheduleDestroy(&
foo2, 0, 0);
539 Simulator::ScheduleDestroy(&
foo3, 0, 0, 0);
540 Simulator::ScheduleDestroy(&
foo4, 0, 0, 0, 0);
541 Simulator::ScheduleDestroy(&
foo5, 0, 0, 0, 0, 0);
542 Simulator::ScheduleDestroy(&
cber1, 0);
543 Simulator::ScheduleDestroy(&
cber2, 0, 0);
544 Simulator::ScheduleDestroy(&
cber3, 0, 0, 0);
545 Simulator::ScheduleDestroy(&
cber4, 0, 0, 0, 0);
546 Simulator::ScheduleDestroy(&
cber5, 0, 0, 0, 0, 0);
584 Simulator::Schedule(
Seconds(0.0),
587 Simulator::Schedule(
Seconds(0.0),
591 Simulator::Schedule(
Seconds(0.0),
596 Simulator::Schedule(
Seconds(0.0),
602 Simulator::Schedule(
Seconds(0.0),
609 Simulator::Schedule(
Seconds(0.0),
678 Simulator::Schedule(
Seconds(0.0), &
ber4, 0, 0, 0, 0);
679 Simulator::Schedule(
Seconds(0.0), &
ber5, 0, 0, 0, 0, 0);
685 Simulator::ScheduleNow(&
ber1, 0);
686 Simulator::ScheduleNow(&
ber2, 0, 0);
687 Simulator::ScheduleNow(&
ber3, 0, 0, 0);
688 Simulator::ScheduleNow(&
ber4, 0, 0, 0, 0);
689 Simulator::ScheduleNow(&
ber5, 0, 0, 0, 0, 0);
695 Simulator::ScheduleDestroy(&
ber1, 0);
696 Simulator::ScheduleDestroy(&
ber2, 0, 0);
697 Simulator::ScheduleDestroy(&
ber3, 0, 0, 0);
698 Simulator::ScheduleDestroy(&
ber4, 0, 0, 0, 0);
699 Simulator::ScheduleDestroy(&
ber5, 0, 0, 0, 0, 0);
707 Simulator::Destroy();
722 factory.
SetTypeId(ListScheduler::GetTypeId());
725 factory.
SetTypeId(MapScheduler::GetTypeId());
727 factory.
SetTypeId(HeapScheduler::GetTypeId());
729 factory.
SetTypeId(CalendarScheduler::GetTypeId());
731 factory.
SetTypeId(PriorityQueueScheduler::GetTypeId());
Check that basic event handling is working with different Simulator implementations.
void EventD(int value)
Test Event.
void Destroy()
Checks that the events has been destroyed.
uint64_t NowUs()
Get the simulator time.
void DoRun() override
Implementation to actually run this TestCase.
void EventC(int value)
Test Event.
bool m_c
Checks that events are properly handled.
SimulatorEventsTestCase(ObjectFactory schedulerFactory)
Constructor.
bool m_a
Checks that events are properly handled.
bool m_destroy
Checks that events are properly handled.
void Eventfoo0()
Test Event.
bool m_b
Checks that events are properly handled.
void EventB(int value)
Test Event.
ObjectFactory m_schedulerFactory
Scheduler factory.
EventId m_destroyId
Event to check event lifetime.
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 bar0()
Function used for scheduling.
void cbaz2(const int &, const int &)
Function used for scheduling.
void Ref() const
Ref and Unref - only here for testing of Ptr<>
void Unref() 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 cbaz4c(const int &, const int &, const int &, const int &) const
Function used for scheduling.
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 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 bar0c() const
Function used for scheduling.
void DoRun() override
Implementation to actually run this TestCase.
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()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsExpired() 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() const
Get an approximation of the time stored in this instance in the indicated unit.
Time Now()
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 foo0()
Function used for scheduling.
static void ber2(int &, int &)
Function used for scheduling.