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);
38 void Eventfoo0 (
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.")
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);
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);
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 ());
static void ber5(int &, int &, int &, int &, int &)
Smart pointer class similar to boost::intrusive_ptr.
static void cber4(const int &, const int &, const int &, const int &)
void bar4(int, int, int, int)
static void ber4(int &, int &, int &, int &)
void bar3c(int, int, int) const
void baz3(int &, int &, int &)
ObjectFactory m_schedulerFactory
static void foo5(int, int, int, int, int)
static void cber5(const int &, const int &, const int &, const int &, const int &)
void baz5(int &, int &, int &, int &, int &)
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
void baz3c(int &, int &, int &) const
SimulatorEventsTestCase(ObjectFactory schedulerFactory)
void cbaz5c(const int &, const int &, const int &, const int &, const int &) const
virtual void DoRun(void)
Implementation to actually run this TestCase.
SimulatorTemplateTestCase()
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
static void ber3(int &, int &, int &)
static void foo3(int, int, int)
void bar5c(int, int, int, int, int) const
void bar4c(int, int, int, int) const
void cbaz5(const int &, const int &, const int &, const int &, const int &)
void baz4c(int &, int &, int &, int &) const
void baz4(int &, int &, int &, int &)
void cbaz1c(const int &) const
virtual void DoRun(void)
Implementation to actually run this TestCase.
void baz2c(int &, int &) const
static void cber3(const int &, const int &, const int &)
void bar5(int, int, int, int, int)
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
SimulatorTestSuite g_simulatorTestSuite
Instantiate subclasses of ns3::Object.
void baz5c(int &, int &, int &, int &, int &) const
static void cber1(const int &)
void cbaz2c(const int &, const int &) const
void cbaz4c(const int &, const int &, const int &, const int &) const
An identifier for simulation events.
void cbaz4(const int &, const int &, const int &, const int &)
Time Seconds(double value)
Construct a Time in the indicated unit.
void cbaz3c(const int &, const int &, const int &) const
static void ber2(int &, int &)
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
void bar2c(int, int) const
static void foo2(int, int)
static void cber2(const int &, const int &)
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void cbaz3(const int &, const int &, const int &)
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
void cbaz2(const int &, const int &)
static void foo4(int, int, int, int)