time simple test case, Checks the basic operations on time More...
Public Member Functions | |
TimeSimpleTestCase () | |
constructor for TimeSimpleTestCase. | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Member Functions | |
void | DoRun () override |
Runs the Simple Time test case. | |
void | DoSetup () override |
setup function for TimeSimpleTestCase. | |
void | DoTeardown () override |
Does the tear down for TimeSimpleTestCase. | |
virtual void | DoTimeOperations () |
Tests the Time Operations. | |
template<typename T > | |
void | TestDivision (Time t, Time expected, T val, const std::string &msg) |
Helper function to handle boilerplate code for division tests. | |
void | TestDivisionByDecimalTypes () |
Test dividing a Time instance by various decimal types. | |
void | TestDivisionByIntegerTypes () |
Test dividing a Time instance by various integer types. | |
template<typename T > | |
void | TestMultiplication (Time t, Time expected, T val, const std::string &msg) |
Helper function to handle boilerplate code for multiplication tests. | |
void | TestMultiplicationByDecimalTypes () |
Test multiplying a Time instance by various decimal types. | |
void | TestMultiplicationByIntegerTypes () |
Test multiplying a Time instance by various integer types. | |
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. | |
time simple test case, Checks the basic operations on time
Definition at line 28 of file time-test-suite.cc.
TimeSimpleTestCase::TimeSimpleTestCase | ( | ) |
constructor for TimeSimpleTestCase.
Definition at line 104 of file time-test-suite.cc.
|
overrideprivatevirtual |
Runs the Simple Time test case.
Implements ns3::TestCase.
Definition at line 149 of file time-test-suite.cc.
References ns3::Days(), DoTimeOperations(), ns3::FemtoSeconds(), ns3::Time::GetInteger(), ns3::Hours(), ns3::MicroSeconds(), ns3::MilliSeconds(), ns3::Minutes(), ns3::NanoSeconds(), NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_EQ_TOL, ns3::PicoSeconds(), ns3::Time::PS, ns3::Seconds(), ns3::Time::SetResolution(), and ns3::Years().
|
overrideprivatevirtual |
setup function for TimeSimpleTestCase.
Reimplemented from ns3::TestCase.
Definition at line 110 of file time-test-suite.cc.
|
overrideprivatevirtual |
Does the tear down for TimeSimpleTestCase.
Reimplemented from ns3::TestCase.
Definition at line 203 of file time-test-suite.cc.
|
privatevirtual |
Tests the Time Operations.
Definition at line 115 of file time-test-suite.cc.
References ns3::Div(), NS_TEST_ASSERT_MSG_EQ, ns3::Rem(), TestDivisionByDecimalTypes(), TestDivisionByIntegerTypes(), TestMultiplicationByDecimalTypes(), and TestMultiplicationByIntegerTypes().
Referenced by DoRun().
|
private |
Helper function to handle boilerplate code for division tests.
T | type of division value |
t | Time value to divide |
expected | Expected result of the division |
val | Value to divide by |
msg | Error message to print if test fails |
Definition at line 279 of file time-test-suite.cc.
References NS_TEST_ASSERT_MSG_EQ.
Referenced by TestDivisionByDecimalTypes(), and TestDivisionByIntegerTypes().
|
private |
Test dividing a Time instance by various decimal types.
Definition at line 315 of file time-test-suite.cc.
References ns3::Seconds(), and TestDivision().
Referenced by DoTimeOperations().
|
private |
Test dividing a Time instance by various integer types.
Definition at line 287 of file time-test-suite.cc.
References ns3::Time::GetTimeStep(), ns3::Seconds(), and TestDivision().
Referenced by DoTimeOperations().
|
private |
Helper function to handle boilerplate code for multiplication tests.
T | type of multiplication value |
t | Time value to multiply |
expected | Expected result of the multiplication |
val | Value to multiply by |
msg | Error message to print if test fails |
Definition at line 209 of file time-test-suite.cc.
References NS_TEST_ASSERT_MSG_EQ.
Referenced by TestMultiplicationByDecimalTypes(), and TestMultiplicationByIntegerTypes().
|
private |
Test multiplying a Time instance by various decimal types.
Definition at line 265 of file time-test-suite.cc.
References ns3::Time::GetDouble(), ns3::Seconds(), and TestMultiplication().
Referenced by DoTimeOperations().
|
private |
Test multiplying a Time instance by various integer types.
Definition at line 225 of file time-test-suite.cc.
References ns3::Time::GetTimeStep(), ns3::Seconds(), and TestMultiplication().
Referenced by DoTimeOperations().