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 (const char *id, double sec, Vector const &p, Vector const &v) |
Add next reference point. More... | |
void | AddReferencePoint (ReferencePoint const &r) |
Add next reference point. 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 | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. More... | |
std::string | GetName (void) const |
TestCase & | operator= (const TestCase &)=delete |
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) | |
Constructor. More... | |
void | AddTestCase (TestCase *testCase, TestDuration duration=QUICK) |
Add an individual child TestCase to this test suite. More... | |
TestCase * | GetParent () 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... | |
Every test case is supposed to:
Definition at line 86 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 129 of file ns2-mobility-helper-test-suite.cc.
|
inlinevirtual |
Empty.
Definition at line 137 of file ns2-mobility-helper-test-suite.cc.
|
inline |
Add next reference point.
id | reference point id |
sec | reference point ime (in seconds) |
p | reference point position |
v | reference point velocity |
Definition at line 163 of file ns2-mobility-helper-test-suite.cc.
References ns3::Seconds().
|
inline |
Add next reference point.
r | reference point to add |
Definition at line 152 of file ns2-mobility-helper-test-suite.cc.
Referenced by Ns2MobilityHelperTestSuite::Ns2MobilityHelperTestSuite().
|
inlineprivate |
Check that all initial positions are correct.
Definition at line 212 of file ns2-mobility-helper-test-suite.cc.
References AreVectorsEqual(), ns3::Object::GetObject(), ns3::MobilityModel::GetPosition(), ns3::MobilityModel::GetVelocity(), Ns2MobilityHelperTest::ReferencePoint::node, NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL, NS_TEST_EXPECT_MSG_EQ, Ns2MobilityHelperTest::ReferencePoint::pos, ns3::Seconds(), and Ns2MobilityHelperTest::ReferencePoint::vel.
|
inlineprivate |
Listen for course change events.
context | event context |
mobility | a pointer to the mobility model |
Definition at line 236 of file ns2-mobility-helper-test-suite.cc.
References AreVectorsEqual(), ns3::Names::FindName(), ns3::Time::GetSeconds(), third::mobility, Ns2MobilityHelperTest::ReferencePoint::node, ns3::Simulator::Now(), NS_ASSERT, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_LT, Ns2MobilityHelperTest::ReferencePoint::pos, Ns2MobilityHelperTest::ReferencePoint::time, and Ns2MobilityHelperTest::ReferencePoint::vel.
Referenced by DoRun().
|
inlineprivate |
Create and name nodes.
Definition at line 197 of file ns2-mobility-helper-test-suite.cc.
References ns3::Names::Add(), and first::nodes.
|
inlineprivatevirtual |
Go.
Implements ns3::TestCase.
Definition at line 273 of file ns2-mobility-helper-test-suite.cc.
References ns3::Config::Connect(), CourseChange(), ns3::MakeCallback(), third::mobility, NS_TEST_ASSERT_MSG_EQ, ns3::Simulator::Run(), and ns3::Simulator::Stop().
|
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 261 of file ns2-mobility-helper-test-suite.cc.
|
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 266 of file ns2-mobility-helper-test-suite.cc.
References ns3::Names::Clear(), and ns3::Simulator::Destroy().
|
inline |
Set NS-2 trace to read as single large string (don't forget to add \n and quote "'s)
trace | the mobility trace |
Definition at line 144 of file ns2-mobility-helper-test-suite.cc.
Referenced by Ns2MobilityHelperTestSuite::Ns2MobilityHelperTestSuite().
|
inlineprivate |
Dump NS-2 trace to tmp file.
Definition at line 187 of file ns2-mobility-helper-test-suite.cc.
References NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL.
|
private |
Next reference point to be checked.
Definition at line 178 of file ns2-mobility-helper-test-suite.cc.
|
private |
Number of nodes used in the test.
Definition at line 172 of file ns2-mobility-helper-test-suite.cc.
|
private |
Reference mobility.
Definition at line 176 of file ns2-mobility-helper-test-suite.cc.
|
private |
Test time limit.
Definition at line 170 of file ns2-mobility-helper-test-suite.cc.
|
private |
Trace as string.
Definition at line 174 of file ns2-mobility-helper-test-suite.cc.
|
private |
TMP trace file name.
Definition at line 180 of file ns2-mobility-helper-test-suite.cc.