A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::tests::TrickleTimerTestCase Class Reference

TrickleTimer test. More...

Inheritance diagram for ns3::tests::TrickleTimerTestCase:
Collaboration diagram for ns3::tests::TrickleTimerTestCase:

Public Member Functions

 TrickleTimerTestCase ()
 Constructor.
void CheckRunningAndStop (TrickleTimer *tricklePtr)
 Check that the timer is running, stop it, and check that it stopped.
void ConsistentEvent (Time interval, TrickleTimer *tricklePtr)
 Inject in the timer a consistent event.
void DoRun () override
 Implementation to actually run this TestCase.
void ExpireTimer ()
 Function to invoke when TrickleTimer expires.
void TestIsRunning (Time unit)
 Test the IsRunning state across the timer lifecycle.
void TestRedundancy (Time unit)
 Test the redundancy suppression.
void TestSteadyState (Time unit)
 Test the steady-state.
void TransientOver ()
 Function to signal that the transient is over.
Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 Caller graph was not generated because of its size.
virtual ~TestCase ()
 Destructor.
std::string GetName () const
TestCase & operator= (const TestCase &)=delete

Public Attributes

bool m_enableDataCollection
 Collect data if true.
std::vector< Time > m_expiredTimes
 Time when TrickleTimer expired.

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...
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.

Detailed Description

TrickleTimer test.

Definition at line 41 of file trickle-timer-test-suite.cc.

Constructor & Destructor Documentation

◆ TrickleTimerTestCase()

ns3::tests::TrickleTimerTestCase::TrickleTimerTestCase ( )

Constructor.

Definition at line 92 of file trickle-timer-test-suite.cc.

References ns3::TestCase::TestCase().

Here is the call graph for this function:

Member Function Documentation

◆ CheckRunningAndStop()

void ns3::tests::TrickleTimerTestCase::CheckRunningAndStop ( TrickleTimer * tricklePtr)

Check that the timer is running, stop it, and check that it stopped.

Parameters
tricklePtrPointer to the TrickleTimer

Definition at line 227 of file trickle-timer-test-suite.cc.

References ns3::TrickleTimer::IsRunning(), NS_TEST_EXPECT_MSG_EQ, and ns3::TrickleTimer::Stop().

Referenced by TestIsRunning().

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

◆ ConsistentEvent()

void ns3::tests::TrickleTimerTestCase::ConsistentEvent ( Time interval,
TrickleTimer * tricklePtr )

Inject in the timer a consistent event.

Parameters
intervalInterval
tricklePtrPointer to the TrickleTimer

Definition at line 190 of file trickle-timer-test-suite.cc.

References ConsistentEvent(), ns3::TrickleTimer::ConsistentEvent(), and ns3::Simulator::Schedule().

Referenced by ConsistentEvent(), and TestRedundancy().

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

◆ DoRun()

void ns3::tests::TrickleTimerTestCase::DoRun ( )
overridevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 237 of file trickle-timer-test-suite.cc.

References ns3::Seconds(), TestIsRunning(), TestRedundancy(), and TestSteadyState().

Here is the call graph for this function:

◆ ExpireTimer()

void ns3::tests::TrickleTimerTestCase::ExpireTimer ( )

Function to invoke when TrickleTimer expires.

Definition at line 98 of file trickle-timer-test-suite.cc.

References m_enableDataCollection, m_expiredTimes, and ns3::Simulator::Now().

Referenced by TestIsRunning(), TestRedundancy(), and TestSteadyState().

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

◆ TestIsRunning()

void ns3::tests::TrickleTimerTestCase::TestIsRunning ( Time unit)

Test the IsRunning state across the timer lifecycle.

Parameters
unitMinimum interval

Definition at line 201 of file trickle-timer-test-suite.cc.

References CheckRunningAndStop(), ns3::Simulator::Destroy(), ns3::TrickleTimer::Enable(), ExpireTimer(), ns3::TrickleTimer::IsRunning(), m_enableDataCollection, m_expiredTimes, NS_TEST_EXPECT_MSG_EQ, ns3::TrickleTimer::Reset(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::TrickleTimer::SetFunction(), and ns3::Simulator::Stop().

Referenced by DoRun().

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

◆ TestRedundancy()

void ns3::tests::TrickleTimerTestCase::TestRedundancy ( Time unit)

Test the redundancy suppression.

Parameters
unitMinimum interval

Definition at line 158 of file trickle-timer-test-suite.cc.

References ConsistentEvent(), ns3::Simulator::Destroy(), ns3::TrickleTimer::Enable(), ExpireTimer(), ns3::TrickleTimer::GetDoublings(), m_enableDataCollection, m_expiredTimes, NS_TEST_EXPECT_MSG_EQ, ns3::TrickleTimer::Reset(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::TrickleTimer::SetFunction(), ns3::Simulator::Stop(), and TransientOver().

Referenced by DoRun().

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

◆ TestSteadyState()

void ns3::tests::TrickleTimerTestCase::TestSteadyState ( Time unit)

Test the steady-state.

Parameters
unitMinimum interval

Definition at line 115 of file trickle-timer-test-suite.cc.

References ns3::Simulator::Destroy(), ns3::TrickleTimer::Enable(), ExpireTimer(), ns3::int64x64_t::GetDouble(), ns3::TrickleTimer::GetDoublings(), m_enableDataCollection, m_expiredTimes, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_GT_OR_EQ, NS_TEST_EXPECT_MSG_LT_OR_EQ, ns3::TrickleTimer::Reset(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::TrickleTimer::SetFunction(), ns3::Simulator::Stop(), and TransientOver().

Referenced by DoRun().

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

◆ TransientOver()

void ns3::tests::TrickleTimerTestCase::TransientOver ( )

Function to signal that the transient is over.

Definition at line 109 of file trickle-timer-test-suite.cc.

References m_enableDataCollection.

Referenced by TestRedundancy(), and TestSteadyState().

Here is the caller graph for this function:

Member Data Documentation

◆ m_enableDataCollection

bool ns3::tests::TrickleTimerTestCase::m_enableDataCollection

Collect data if true.

Definition at line 89 of file trickle-timer-test-suite.cc.

Referenced by ExpireTimer(), TestIsRunning(), TestRedundancy(), TestSteadyState(), and TransientOver().

◆ m_expiredTimes

std::vector<Time> ns3::tests::TrickleTimerTestCase::m_expiredTimes

Time when TrickleTimer expired.

Definition at line 51 of file trickle-timer-test-suite.cc.

Referenced by ExpireTimer(), TestIsRunning(), TestRedundancy(), and TestSteadyState().


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