A Discrete-Event Network Simulator
API
TimeSimpleTestCase Class Reference

time simple test case, Checks the basic operations on time More...

+ Inheritance diagram for TimeSimpleTestCase:
+ Collaboration diagram for TimeSimpleTestCase:

Public Member Functions

 TimeSimpleTestCase ()
 constructor for TimeSimpleTestCase. More...
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName (void) const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

virtual void DoRun (void)
 Runs the Simple Time test case. More...
 
virtual void DoSetup (void)
 setup function for TimeSimpleTestCase. More...
 
virtual void DoTeardown (void)
 Does the tear down for TimeSimpleTestCase. More...
 
virtual void DoTimeOperations (void)
 Tests the Time Operations. More...
 
template<typename T >
void TestDivision (Time t, Time expected, T val, const std::string &msg)
 Helper function to handle boilerplate code for division tests. More...
 
void TestDivisionByDecimalTypes ()
 Test dividing a Time instance by various decimal types. More...
 
void TestDivisionByIntegerTypes ()
 Test dividing a Time instance by various integer types. More...
 
template<typename T >
void TestMultiplication (Time t, Time expected, T val, const std::string &msg)
 Helper function to handle boilerplate code for multiplication tests. More...
 
void TestMultiplicationByDecimalTypes ()
 Test multiplying a Time instance by various decimal types. More...
 
void TestMultiplicationByIntegerTypes ()
 Test multiplying a Time instance by various integer types. More...
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { 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. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCsse. More...
 
bool IsStatusFailure (void) const
 Check if any tests failed. More...
 
bool IsStatusSuccess (void) const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
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. More...
 
bool MustAssertOnFailure (void) const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure (void) const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

Detailed Description

time simple test case, Checks the basic operations on time

Definition at line 39 of file time-test-suite.cc.

Constructor & Destructor Documentation

◆ TimeSimpleTestCase()

TimeSimpleTestCase::TimeSimpleTestCase ( )

constructor for TimeSimpleTestCase.

Definition at line 115 of file time-test-suite.cc.

Member Function Documentation

◆ DoRun()

void TimeSimpleTestCase::DoRun ( void  )
privatevirtual

◆ DoSetup()

void TimeSimpleTestCase::DoSetup ( void  )
privatevirtual

setup function for TimeSimpleTestCase.

Reimplemented from ns3::TestCase.

Definition at line 120 of file time-test-suite.cc.

◆ DoTeardown()

void TimeSimpleTestCase::DoTeardown ( void  )
privatevirtual

Does the tear down for TimeSimpleTestCase.

Reimplemented from ns3::TestCase.

Definition at line 207 of file time-test-suite.cc.

◆ DoTimeOperations()

void TimeSimpleTestCase::DoTimeOperations ( void  )
privatevirtual

Tests the Time Operations.

Definition at line 123 of file time-test-suite.cc.

References ns3::Div(), NS_TEST_ASSERT_MSG_EQ, ns3::Rem(), TestDivisionByDecimalTypes(), TestDivisionByIntegerTypes(), TestMultiplicationByDecimalTypes(), and TestMultiplicationByIntegerTypes().

Referenced by DoRun().

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

◆ TestDivision()

template<typename T >
void TimeSimpleTestCase::TestDivision ( Time  t,
Time  expected,
val,
const std::string &  msg 
)
private

Helper function to handle boilerplate code for division tests.

Template Parameters
Ttype of division value
Parameters
tTime value to divide
expectedExpected result of the divsion
valValue to divide by
msgError message to print if test fails

Definition at line 278 of file time-test-suite.cc.

References NS_TEST_ASSERT_MSG_EQ, and test-ns3::result.

Referenced by TestDivisionByDecimalTypes(), and TestDivisionByIntegerTypes().

+ Here is the caller graph for this function:

◆ TestDivisionByDecimalTypes()

void TimeSimpleTestCase::TestDivisionByDecimalTypes ( )
private

Test dividing a Time instance by various decimal types.

Definition at line 318 of file time-test-suite.cc.

References ns3::Seconds(), and TestDivision().

Referenced by DoTimeOperations().

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

◆ TestDivisionByIntegerTypes()

void TimeSimpleTestCase::TestDivisionByIntegerTypes ( )
private

Test dividing a Time instance by various integer types.

Definition at line 286 of file time-test-suite.cc.

References ns3::Time::GetTimeStep(), ns3::Seconds(), and TestDivision().

Referenced by DoTimeOperations().

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

◆ TestMultiplication()

template<typename T >
void TimeSimpleTestCase::TestMultiplication ( Time  t,
Time  expected,
val,
const std::string &  msg 
)
private

Helper function to handle boilerplate code for multiplication tests.

Template Parameters
Ttype of multiplication value
Parameters
tTime value to multiply
expectedExpected result of the multiplication
valValue to multiply by
msgError message to print if test fails

Definition at line 212 of file time-test-suite.cc.

Referenced by TestMultiplicationByDecimalTypes(), and TestMultiplicationByIntegerTypes().

+ Here is the caller graph for this function:

◆ TestMultiplicationByDecimalTypes()

void TimeSimpleTestCase::TestMultiplicationByDecimalTypes ( )
private

Test multiplying a Time instance by various decimal types.

Definition at line 263 of file time-test-suite.cc.

References ns3::Time::GetDouble(), ns3::Seconds(), and TestMultiplication().

Referenced by DoTimeOperations().

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

◆ TestMultiplicationByIntegerTypes()

void TimeSimpleTestCase::TestMultiplicationByIntegerTypes ( )
private

Test multiplying a Time instance by various integer types.

Definition at line 231 of file time-test-suite.cc.

References ns3::Time::GetTimeStep(), ns3::Seconds(), and TestMultiplication().

Referenced by DoTimeOperations().

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

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