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)
118 if (b != 2 ||
NowUs() != 11)
126 Simulator::Remove(
m_idC);
139 if (d != 4 ||
NowUs() != (11 + 10))
179 Simulator::Cancel(a);
191 "Event should not have expired yet.");
193 Simulator::Remove(anId);
203 "Event was canceled: should have expired now");
210 "Event was canceled: should have expired now");
219 Simulator::Destroy();
245 void DoRun()
override;
256 void bar4(
int,
int,
int,
int){};
257 void bar5(
int,
int,
int,
int,
int){};
261 void baz4(
int&,
int&,
int&,
int&){};
262 void baz5(
int&,
int&,
int&,
int&,
int&){};
264 void cbaz2(
const int&,
const int&){};
265 void cbaz3(
const int&,
const int&,
const int&){};
266 void cbaz4(
const int&,
const int&,
const int&,
const int&){};
267 void cbaz5(
const int&,
const int&,
const int&,
const int&,
const int&){};
273 void bar4c(
int,
int,
int,
int)
const {};
274 void bar5c(
int,
int,
int,
int,
int)
const {};
277 void baz3c(
int&,
int&,
int&)
const {};
278 void baz4c(
int&,
int&,
int&,
int&)
const {};
279 void baz5c(
int&,
int&,
int&,
int&,
int&)
const {};
281 void cbaz2c(
const int&,
const int&)
const {};
282 void cbaz3c(
const int&,
const int&,
const int&)
const {};
283 void cbaz4c(
const int&,
const int&,
const int&,
const int&)
const {};
284 void cbaz5c(
const int&,
const int&,
const int&,
const int&,
const int&)
const {};
344 ber5(
int&,
int&,
int&,
int&,
int&)
359 cber3(
const int&,
const int&,
const int&)
364 cber4(
const int&,
const int&,
const int&,
const int&)
369 cber5(
const int&,
const int&,
const int&,
const int&,
const int&)
376 :
TestCase(
"Check that all templates are instantiated correctly. This is a compilation test, "
377 "it cannot fail at runtime.")
435 Simulator::Schedule(
Seconds(0.0),
438 Simulator::Schedule(
Seconds(0.0),
442 Simulator::Schedule(
Seconds(0.0),
447 Simulator::Schedule(
Seconds(0.0),
453 Simulator::Schedule(
Seconds(0.0),
460 Simulator::Schedule(
Seconds(0.0),
528 Simulator::Schedule(
Seconds(0.0), &
foo4, 0, 0, 0, 0);
529 Simulator::Schedule(
Seconds(0.0), &
foo5, 0, 0, 0, 0, 0);
534 Simulator::Schedule(
Seconds(0.0), &
cber5, 0, 0, 0, 0, 0);
535 Simulator::ScheduleNow(&
foo0);
536 Simulator::ScheduleNow(&
foo1, 0);
537 Simulator::ScheduleNow(&
foo2, 0, 0);
538 Simulator::ScheduleNow(&
foo3, 0, 0, 0);
539 Simulator::ScheduleNow(&
foo4, 0, 0, 0, 0);
540 Simulator::ScheduleNow(&
foo5, 0, 0, 0, 0, 0);
541 Simulator::ScheduleNow(&
cber1, 0);
542 Simulator::ScheduleNow(&
cber2, 0, 0);
543 Simulator::ScheduleNow(&
cber3, 0, 0, 0);
544 Simulator::ScheduleNow(&
cber4, 0, 0, 0, 0);
545 Simulator::ScheduleNow(&
cber5, 0, 0, 0, 0, 0);
546 Simulator::ScheduleDestroy(&
foo0);
547 Simulator::ScheduleDestroy(&
foo1, 0);
548 Simulator::ScheduleDestroy(&
foo2, 0, 0);
549 Simulator::ScheduleDestroy(&
foo3, 0, 0, 0);
550 Simulator::ScheduleDestroy(&
foo4, 0, 0, 0, 0);
551 Simulator::ScheduleDestroy(&
foo5, 0, 0, 0, 0, 0);
552 Simulator::ScheduleDestroy(&
cber1, 0);
553 Simulator::ScheduleDestroy(&
cber2, 0, 0);
554 Simulator::ScheduleDestroy(&
cber3, 0, 0, 0);
555 Simulator::ScheduleDestroy(&
cber4, 0, 0, 0, 0);
556 Simulator::ScheduleDestroy(&
cber5, 0, 0, 0, 0, 0);
594 Simulator::Schedule(
Seconds(0.0),
597 Simulator::Schedule(
Seconds(0.0),
601 Simulator::Schedule(
Seconds(0.0),
606 Simulator::Schedule(
Seconds(0.0),
612 Simulator::Schedule(
Seconds(0.0),
619 Simulator::Schedule(
Seconds(0.0),
688 Simulator::Schedule(
Seconds(0.0), &
ber4, 0, 0, 0, 0);
689 Simulator::Schedule(
Seconds(0.0), &
ber5, 0, 0, 0, 0, 0);
695 Simulator::ScheduleNow(&
ber1, 0);
696 Simulator::ScheduleNow(&
ber2, 0, 0);
697 Simulator::ScheduleNow(&
ber3, 0, 0, 0);
698 Simulator::ScheduleNow(&
ber4, 0, 0, 0, 0);
699 Simulator::ScheduleNow(&
ber5, 0, 0, 0, 0, 0);
705 Simulator::ScheduleDestroy(&
ber1, 0);
706 Simulator::ScheduleDestroy(&
ber2, 0, 0);
707 Simulator::ScheduleDestroy(&
ber3, 0, 0, 0);
708 Simulator::ScheduleDestroy(&
ber4, 0, 0, 0, 0);
709 Simulator::ScheduleDestroy(&
ber5, 0, 0, 0, 0, 0);
717 Simulator::Destroy();
732 factory.
SetTypeId(ListScheduler::GetTypeId());
735 factory.
SetTypeId(MapScheduler::GetTypeId());
737 factory.
SetTypeId(HeapScheduler::GetTypeId());
739 factory.
SetTypeId(CalendarScheduler::GetTypeId());
741 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.