Check that basic event handling is working with different Simulator implementations. More...
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 |
TestCase & | operator= (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... | |
Static Public Attributes inherited from ns3::TestCase | |
static constexpr auto | QUICK = Duration::QUICK |
Deprecated test duration simple enums. | |
static constexpr auto | EXTENSIVE = Duration::EXTENSIVE |
static constexpr auto | TAKES_FOREVER = Duration::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. | |
TestCase * | GetParent () 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. | |
Check that basic event handling is working with different Simulator implementations.
Definition at line 34 of file simulator-test-suite.cc.
SimulatorEventsTestCase::SimulatorEventsTestCase | ( | ObjectFactory | schedulerFactory | ) |
Constructor.
schedulerFactory | Scheduler factory. |
Definition at line 84 of file simulator-test-suite.cc.
void SimulatorEventsTestCase::Destroy | ( | ) |
Checks that the events has been destroyed.
Definition at line 130 of file simulator-test-suite.cc.
References ns3::EventId::IsExpired(), m_destroy, and m_destroyId.
Referenced by DoRun().
|
overridevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 139 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().
void SimulatorEventsTestCase::EventA | ( | int | value | ) |
Test Event.
value | Event parameter. |
Definition at line 99 of file simulator-test-suite.cc.
References m_a.
Referenced by DoRun().
void SimulatorEventsTestCase::EventB | ( | int | value | ) |
Test Event.
value | Event parameter. |
Definition at line 105 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().
void SimulatorEventsTestCase::EventC | ( | int | value | ) |
Test Event.
value | Event parameter. |
Definition at line 113 of file simulator-test-suite.cc.
References m_c.
Referenced by DoRun().
void SimulatorEventsTestCase::EventD | ( | int | value | ) |
Test Event.
value | Event parameter. |
Definition at line 119 of file simulator-test-suite.cc.
Referenced by EventB().
void SimulatorEventsTestCase::Eventfoo0 | ( | ) |
Test Event.
Definition at line 125 of file simulator-test-suite.cc.
Referenced by DoRun().
uint64_t SimulatorEventsTestCase::NowUs | ( | ) |
Get the simulator time.
Definition at line 92 of file simulator-test-suite.cc.
References ns3::Time::GetNanoSeconds(), and ns3::Now().
Referenced by EventB(), and EventD().
bool SimulatorEventsTestCase::m_a |
Checks that events are properly handled.
Definition at line 72 of file simulator-test-suite.cc.
bool SimulatorEventsTestCase::m_b |
Checks that events are properly handled.
Definition at line 73 of file simulator-test-suite.cc.
bool SimulatorEventsTestCase::m_c |
Checks that events are properly handled.
Definition at line 74 of file simulator-test-suite.cc.
bool SimulatorEventsTestCase::m_d |
Checks that events are properly handled.
Definition at line 75 of file simulator-test-suite.cc.
bool SimulatorEventsTestCase::m_destroy |
Checks that events are properly handled.
Definition at line 76 of file simulator-test-suite.cc.
EventId SimulatorEventsTestCase::m_destroyId |
Event to check event lifetime.
Definition at line 80 of file simulator-test-suite.cc.
EventId SimulatorEventsTestCase::m_idC |
Event C.
Definition at line 79 of file simulator-test-suite.cc.
ObjectFactory SimulatorEventsTestCase::m_schedulerFactory |