Every test case is supposed to: More...
Classes | |
struct | ReferencePoint |
Single record in mobility reference. More... | |
Public Member Functions | |
Ns2MobilityHelperTest (std::string const &name, Time timeLimit, uint32_t nodes=1) | |
Create new test case. More... | |
virtual | ~Ns2MobilityHelperTest () |
Empty. More... | |
void | AddReferencePoint (ReferencePoint const &r) |
Add next reference point. More... | |
void | AddReferencePoint (const char *id, double sec, Vector const &p, Vector const &v) |
Sugar. More... | |
void | SetTrace (std::string const &trace) |
Set NS-2 trace to read as single large string (don't forget to add \n and quote "'s) More... | |
Public Member Functions inherited from ns3::TestCase | |
virtual | ~TestCase () |
Destructor. More... | |
Private Member Functions | |
bool | CheckInitialPositions () |
Check that all initial positions are correct. More... | |
void | CourseChange (std::string context, Ptr< const MobilityModel > mobility) |
Listen for course change events. More... | |
void | CreateNodes () |
Create and name nodes. More... | |
void | DoRun () |
Go. More... | |
void | DoSetup () |
Implementation to do any local setup required for this TestCase. More... | |
void | DoTeardown () |
Implementation to do any local setup required for this TestCase. More... | |
bool | WriteTrace () |
Dump NS-2 trace to tmp file. More... | |
Private Attributes | |
size_t | m_nextRefPoint |
Next reference point to be checked. More... | |
uint32_t | m_nodeCount |
Number of nodes used in the test. More... | |
std::vector< ReferencePoint > | m_reference |
Reference mobility. More... | |
Time | m_timeLimit |
Test time limit. More... | |
std::string | m_trace |
Trace as string. More... | |
std::string | m_traceFile |
TMP trace file name. 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) | |
void | AddTestCase (TestCase *testCase) NS_DEPRECATED |
Add an individual child TestCase case to this TestCase. More... | |
void | AddTestCase (TestCase *testCase, enum TestDuration duration) |
Add an individual child TestCase to this test suite. More... | |
std::string | CreateDataDirFilename (std::string filename) |
std::string | CreateTempDirFilename (std::string filename) |
bool | GetErrorStatus (void) const NS_DEPRECATED |
std::string | GetName (void) const |
bool | IsStatusFailure (void) const |
bool | IsStatusSuccess (void) const |
bool | MustAssertOnFailure (void) const |
bool | MustContinueOnFailure (void) const |
void | ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line) |
void | SetDataDir (std::string directory) |
Every test case is supposed to:
Definition at line 83 of file ns2-mobility-helper-test-suite.cc.
|
inline |
Create new test case.
To make it useful SetTrace () and AddReferencePoint () must be called
name | Short description |
timeLimit | Test time limit |
nodes | Number of nodes used in the test trace, 1 by default |
Definition at line 114 of file ns2-mobility-helper-test-suite.cc.
|
inlinevirtual |
Empty.
Definition at line 122 of file ns2-mobility-helper-test-suite.cc.
|
inline |
Add next reference point.
Definition at line 131 of file ns2-mobility-helper-test-suite.cc.
References m_reference.
Referenced by AddReferencePoint(), and ns3::Ns2MobilityHelperTestSuite::Ns2MobilityHelperTestSuite().
|
inline |
Sugar.
Definition at line 136 of file ns2-mobility-helper-test-suite.cc.
References AddReferencePoint().
|
inlineprivate |
Check that all initial positions are correct.
Definition at line 179 of file ns2-mobility-helper-test-suite.cc.
References ns3::AreVectorsEqual(), ns3::Object::GetObject(), ns3::MobilityModel::GetPosition(), ns3::MobilityModel::GetVelocity(), ns3::TestCase::IsStatusFailure(), m_nextRefPoint, m_reference, ns3::Ns2MobilityHelperTest::ReferencePoint::node, NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL, NS_TEST_EXPECT_MSG_EQ, ns3::Ns2MobilityHelperTest::ReferencePoint::pos, and ns3::Ns2MobilityHelperTest::ReferencePoint::vel.
Referenced by DoRun().
|
inlineprivate |
Listen for course change events.
Definition at line 199 of file ns2-mobility-helper-test-suite.cc.
References ns3::AreVectorsEqual(), ns3::Names::FindName(), ns3::Time::GetSeconds(), m_nextRefPoint, m_reference, ns3::Ns2MobilityHelperTest::ReferencePoint::node, ns3::Simulator::Now(), NS_ASSERT, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_LT, ns3::Ns2MobilityHelperTest::ReferencePoint::pos, ns3::Ns2MobilityHelperTest::ReferencePoint::time, and ns3::Ns2MobilityHelperTest::ReferencePoint::vel.
Referenced by DoRun().
|
inlineprivate |
Create and name nodes.
Definition at line 167 of file ns2-mobility-helper-test-suite.cc.
References ns3::Names::Add(), ns3::NodeContainer::Create(), ns3::NodeContainer::Get(), m_nodeCount, and first::nodes.
Referenced by DoSetup().
|
inlineprivatevirtual |
Go.
Implements ns3::TestCase.
Definition at line 240 of file ns2-mobility-helper-test-suite.cc.
References CheckInitialPositions(), ns3::Config::Connect(), CourseChange(), ns3::Ns2MobilityHelper::Install(), m_reference, m_timeLimit, m_trace, m_traceFile, ns3::MakeCallback(), NS_TEST_ASSERT_MSG_EQ, ns3::Simulator::Run(), ns3::Simulator::Stop(), and WriteTrace().
|
inlineprivatevirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.
Reimplemented from ns3::TestCase.
Definition at line 224 of file ns2-mobility-helper-test-suite.cc.
References CreateNodes().
|
inlineprivatevirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test teardown
Reimplemented from ns3::TestCase.
Definition at line 229 of file ns2-mobility-helper-test-suite.cc.
References ns3::Names::Clear(), ns3::Simulator::Destroy(), m_traceFile, and NS_LOG_ERROR.
|
inline |
Set NS-2 trace to read as single large string (don't forget to add \n and quote "'s)
Definition at line 126 of file ns2-mobility-helper-test-suite.cc.
References m_trace.
Referenced by ns3::Ns2MobilityHelperTestSuite::Ns2MobilityHelperTestSuite().
|
inlineprivate |
Dump NS-2 trace to tmp file.
Definition at line 157 of file ns2-mobility-helper-test-suite.cc.
References ns3::TestCase::CreateTempDirFilename(), m_trace, m_traceFile, and NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL.
Referenced by DoRun().
|
private |
Next reference point to be checked.
Definition at line 151 of file ns2-mobility-helper-test-suite.cc.
Referenced by CheckInitialPositions(), and CourseChange().
|
private |
Number of nodes used in the test.
Definition at line 145 of file ns2-mobility-helper-test-suite.cc.
Referenced by CreateNodes().
|
private |
Reference mobility.
Definition at line 149 of file ns2-mobility-helper-test-suite.cc.
Referenced by AddReferencePoint(), CheckInitialPositions(), CourseChange(), and DoRun().
|
private |
Test time limit.
Definition at line 143 of file ns2-mobility-helper-test-suite.cc.
Referenced by DoRun().
|
private |
Trace as string.
Definition at line 147 of file ns2-mobility-helper-test-suite.cc.
Referenced by DoRun(), SetTrace(), and WriteTrace().
|
private |
TMP trace file name.
Definition at line 153 of file ns2-mobility-helper-test-suite.cc.
Referenced by DoRun(), DoTeardown(), and WriteTrace().