A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
SimulatorEventsTestCase Class Reference

Check that basic event handling is working with different Simulator implementations. More...

+ Inheritance diagram for SimulatorEventsTestCase:
+ Collaboration diagram for SimulatorEventsTestCase:

Public Member Functions

 SimulatorEventsTestCase (ObjectFactory schedulerFactory)
 Constructor.
 
void Destroy ()
 Checks that the events has been destroyed.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void Eventfoo0 ()
 Test Event.
 
uint64_t NowUs ()
 Get the simulator time.
 
void EventA (int value)
 Test Event.
 
void EventB (int value)
 Test Event.
 
void EventC (int value)
 Test Event.
 
void EventD (int value)
 Test Event.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Public Attributes

EventId m_destroyId
 Event to check event lifetime.
 
EventId m_idC
 Event C.
 
ObjectFactory m_schedulerFactory
 Scheduler factory.
 
bool m_a
 Checks that events are properly handled.
 
bool m_b
 Checks that events are properly handled.
 
bool m_c
 Checks that events are properly handled.
 
bool m_d
 Checks that events are properly handled.
 
bool m_destroy
 Checks that events are properly handled.
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
using instead = Duration
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto QUICK = Duration::QUICK
 
static constexpr auto TAKES_FOREVER
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

Check that basic event handling is working with different Simulator implementations.

Definition at line 45 of file simulator-test-suite.cc.

Constructor & Destructor Documentation

◆ SimulatorEventsTestCase()

SimulatorEventsTestCase::SimulatorEventsTestCase ( ObjectFactory  schedulerFactory)

Constructor.

Parameters
schedulerFactoryScheduler factory.

Definition at line 95 of file simulator-test-suite.cc.

Member Function Documentation

◆ Destroy()

void SimulatorEventsTestCase::Destroy ( )

Checks that the events has been destroyed.

Definition at line 141 of file simulator-test-suite.cc.

References ns3::EventId::IsExpired(), m_destroy, and m_destroyId.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRun()

void SimulatorEventsTestCase::DoRun ( )
overridevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 150 of file simulator-test-suite.cc.

References ns3::EventId::Cancel(), ns3::Simulator::Cancel(), ns3::Simulator::Destroy(), Destroy(), EventA(), EventB(), EventC(), Eventfoo0(), ns3::EventId::IsExpired(), m_a, m_b, m_c, m_d, m_destroy, m_destroyId, m_idC, m_schedulerFactory, ns3::MicroSeconds(), NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Remove(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Simulator::ScheduleDestroy(), ns3::Simulator::ScheduleNow(), and ns3::Simulator::SetScheduler().

+ Here is the call graph for this function:

◆ EventA()

void SimulatorEventsTestCase::EventA ( int  value)

Test Event.

Parameters
valueEvent parameter.

Definition at line 110 of file simulator-test-suite.cc.

References m_a.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ EventB()

void SimulatorEventsTestCase::EventB ( int  value)

Test Event.

Parameters
valueEvent parameter.

Definition at line 116 of file simulator-test-suite.cc.

References EventD(), m_b, m_idC, ns3::MicroSeconds(), NowUs(), ns3::Simulator::Remove(), and ns3::Simulator::Schedule().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EventC()

void SimulatorEventsTestCase::EventC ( int  value)

Test Event.

Parameters
valueEvent parameter.

Definition at line 124 of file simulator-test-suite.cc.

References m_c.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ EventD()

void SimulatorEventsTestCase::EventD ( int  value)

Test Event.

Parameters
valueEvent parameter.

Definition at line 130 of file simulator-test-suite.cc.

References m_d, and NowUs().

Referenced by EventB().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Eventfoo0()

void SimulatorEventsTestCase::Eventfoo0 ( )

Test Event.

Definition at line 136 of file simulator-test-suite.cc.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ NowUs()

uint64_t SimulatorEventsTestCase::NowUs ( )

Get the simulator time.

Returns
The actual time [ms].

Definition at line 103 of file simulator-test-suite.cc.

References ns3::Time::GetNanoSeconds(), and ns3::Now().

Referenced by EventB(), and EventD().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_a

bool SimulatorEventsTestCase::m_a

Checks that events are properly handled.

Definition at line 83 of file simulator-test-suite.cc.

Referenced by DoRun(), and EventA().

◆ m_b

bool SimulatorEventsTestCase::m_b

Checks that events are properly handled.

Definition at line 84 of file simulator-test-suite.cc.

Referenced by DoRun(), and EventB().

◆ m_c

bool SimulatorEventsTestCase::m_c

Checks that events are properly handled.

Definition at line 85 of file simulator-test-suite.cc.

Referenced by DoRun(), and EventC().

◆ m_d

bool SimulatorEventsTestCase::m_d

Checks that events are properly handled.

Definition at line 86 of file simulator-test-suite.cc.

Referenced by DoRun(), and EventD().

◆ m_destroy

bool SimulatorEventsTestCase::m_destroy

Checks that events are properly handled.

Definition at line 87 of file simulator-test-suite.cc.

Referenced by Destroy(), and DoRun().

◆ m_destroyId

EventId SimulatorEventsTestCase::m_destroyId

Event to check event lifetime.

Definition at line 91 of file simulator-test-suite.cc.

Referenced by Destroy(), and DoRun().

◆ m_idC

EventId SimulatorEventsTestCase::m_idC

Event C.

Definition at line 90 of file simulator-test-suite.cc.

Referenced by DoRun(), and EventB().

◆ m_schedulerFactory

ObjectFactory SimulatorEventsTestCase::m_schedulerFactory

Scheduler factory.

Definition at line 92 of file simulator-test-suite.cc.

Referenced by DoRun().


The documentation for this class was generated from the following file: