A Discrete-Event Network Simulator
API
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. More...
 
void Destroy (void)
 Checks that the events has been detroyed. More...
 
virtual void DoRun (void)
 Implementation to actually run this TestCase. More...
 
void Eventfoo0 (void)
 Test Event. More...
 
uint64_t NowUs (void)
 Get the simulator time. More...
 
void EventA (int value)
 Test Event. More...
 
void EventB (int value)
 Test Event. More...
 
void EventC (int value)
 Test Event. More...
 
void EventD (int value)
 Test Event. More...
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName (void) const
 
TestCaseoperator= (const TestCase &)=delete
 

Public Attributes

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

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCsse. More...
 
bool IsStatusFailure (void) const
 Check if any tests failed. More...
 
bool IsStatusSuccess (void) const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
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. More...
 
bool MustAssertOnFailure (void) const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure (void) const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ SimulatorEventsTestCase()

SimulatorEventsTestCase::SimulatorEventsTestCase ( ObjectFactory  schedulerFactory)

Constructor.

Parameters
schedulerFactoryScheduler factory.

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

Member Function Documentation

◆ Destroy()

void SimulatorEventsTestCase::Destroy ( void  )

Checks that the events has been detroyed.

Definition at line 153 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 ( void  )
virtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

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

References ns3::EventId::Cancel(), 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(), and NS_TEST_EXPECT_MSG_EQ.

+ Here is the call graph for this function:

◆ EventA()

void SimulatorEventsTestCase::EventA ( int  value)

Test Event.

Parameters
valueEvent parameter.

Definition at line 109 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 115 of file simulator-test-suite.cc.

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

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 130 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 136 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 ( void  )

Test Event.

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

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ NowUs()

uint64_t SimulatorEventsTestCase::NowUs ( void  )

Get the simulator time.

Returns
The actual time [ms].

Definition at line 102 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 84 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 85 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 86 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 87 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 88 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 92 of file simulator-test-suite.cc.

Referenced by Destroy(), and DoRun().

◆ m_idC

EventId SimulatorEventsTestCase::m_idC

Event C.

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

Referenced by DoRun(), and EventB().

◆ m_schedulerFactory

ObjectFactory SimulatorEventsTestCase::m_schedulerFactory

Scheduler factory.

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

Referenced by DoRun().


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