21 #include "ns3/data-rate.h" 24 #include "ns3/simulator.h" 33 void CheckTimesEqual (
Time t1,
Time t2,
const std::string msg);
36 virtual void DoRun (
void) = 0;
59 void SingleTest (std::string rate,
size_t nBits,
Time correctTime);
62 virtual void DoRun (
void);
75 CheckTimesEqual (bitsTime, correctTime,
"CalculateBitsTxTime returned incorrect value");
79 CheckTimesEqual (bytesTime, correctTime,
"CalculateBytesTxTime returned incorrect value");
86 if (Time::GetResolution () != Time::FS)
88 Time::SetResolution (Time::FS);
95 for (nBits = 0; nBits <= 512; nBits++)
Simulation virtual time values and global simulation resolution.
DataRateTestCase(std::string name)
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.
void CheckTimesEqual(Time t1, Time t2, const std::string msg)
Time PicoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Class for representing data rates.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
virtual ~DataRateTestCase()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time CalculateBitsTxTime(uint32_t bits) const
Calculate transmission time.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
int64_t GetFemtoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Time CalculateBytesTxTime(uint32_t bytes) const
Calculate transmission time.
static DataRateTestSuite sDataRateTestSuite
void SingleTest(std::string rate, size_t nBits, Time correctTime)
virtual void DoRun(void)
Implementation to actually run this TestCase.