9#include "ns3/data-rate.h"
11#include "ns3/simulator.h"
97 void DoRun()
override;
110 CheckTimesEqual(bitsTime, correctTime,
"CalculateBitsTxTime returned incorrect value");
111 if ((nBits % 8) == 0)
114 CheckTimesEqual(bytesTime, correctTime,
"CalculateBytesTxTime returned incorrect value");
130 for (nBits = 0; nBits <= 512; nBits++)
162 void AdditionTest(std::string rate1, std::string rate2, std::string rate3);
169 void SubtractionTest(std::string rate1, std::string rate2, std::string rate3);
186 void DoRun()
override;
228 "DataRate Multiplication with Int returned incorrect value");
231 CheckDataRateEqual(dr1, dr2,
"DataRate Multiplication with Int returned incorrect value");
242 "DataRate Multiplication with Double returned incorrect value");
245 CheckDataRateEqual(dr1, dr2,
"DataRate Multiplication with Double returned incorrect value");
void DoRun() override
Implementation to actually run this TestCase.
void SingleTest(std::string rate, size_t nBits, Time correctTime)
Checks that a given number of bits, at a specified datarate, are corresponding to a given time.
void MultiplicationIntTest(std::string rate1, uint64_t factor, std::string rate2)
Checks data rate integer multiplication.
void DoRun() override
Implementation to actually run this TestCase.
void MultiplicationDoubleTest(std::string rate1, double factor, std::string rate2)
Checks data rate floating point multiplication.
void SubtractionTest(std::string rate1, std::string rate2, std::string rate3)
Checks data rate subtraction.
void AdditionTest(std::string rate1, std::string rate2, std::string rate3)
Checks data rate addition.
~DataRateTestCase() override
void CheckTimesEqual(Time t1, Time t2, const std::string msg)
Checks if two time values are equal.
void CheckDataRateEqual(DataRate d1, DataRate d2, const std::string msg)
Checks if two data rates values are equal.
void DoRun() override=0
Implementation to actually run this TestCase.
DataRateTestCase(std::string name)
Constructor.
Class for representing data rates.
Time CalculateBitsTxTime(uint32_t bits) const
Calculate transmission time.
Time CalculateBytesTxTime(uint32_t bytes) const
Calculate transmission time.
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.
int64_t GetFemtoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
static Unit GetResolution()
static void SetResolution(Unit resolution)
High precision numerical type, implementing Q64.64 fixed precision.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time PicoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static DataRateTestSuite sDataRateTestSuite
Static variable for test initialization.