10#include "ns3/trickle-timer.h"
46 void DoRun()
override;
81 :
TestCase(
"Check the Trickle Timer algorithm")
116 "The doublings re-compute mechanism is not working.");
126 std::vector<Time> expirationFrequency;
131 expirationFrequency.begin());
132 expirationFrequency.erase(expirationFrequency.begin());
137 (*std::min_element(expirationFrequency.begin(), expirationFrequency.end())) / unit;
139 (*std::max_element(expirationFrequency.begin(), expirationFrequency.end())) / unit;
159 "The doublings re-compute mechanism is not working.");
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
A Trickle Timer following RFC 6206 .
uint8_t GetDoublings() const
Get the doublings of the timer.
void Reset()
Reset the timer.
void SetFunction(FN fn)
Set the function to execute when the timer expires.
void Enable()
Enable the timer.
void ConsistentEvent()
Records a consistent event.
High precision numerical type, implementing Q64.64 fixed precision.
double GetDouble() const
Get this value as a double.
void TestRedundancy(Time unit)
Test the redundancy suppression.
bool m_enableDataCollection
Collect data if true.
void TestSteadyState(Time unit)
Test the steady-state.
TrickleTimerTestCase()
Constructor.
void TransientOver()
Function to signal that the transient is over.
void ExpireTimer()
Function to invoke when TrickleTimer expires.
std::vector< Time > m_expiredTimes
Time when TrickleTimer expired.
void DoRun() override
Implementation to actually run this TestCase.
void ConsistentEvent(Time interval, TrickleTimer *tricklePtr)
Inject in the timer a consistent event.
Trickle Timer test suite.
TrickleTimerTestSuite()
Constructor.
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to limit and report if not.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
static TrickleTimerTestSuite g_trickleTimerTestSuite
TrickleTimerTestSuite instance variable.
Every class exported by the ns3 library is enclosed in the ns3 namespace.