A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::Ns2MobilityHelperTest Class Reference
+ Inheritance diagram for ns3::Ns2MobilityHelperTest:
+ Collaboration diagram for ns3::Ns2MobilityHelperTest:

Classes

struct  ReferencePoint
 Single record in mobility reference. More...

Public Member Functions

 Ns2MobilityHelperTest (std::string const &name, Time timeLimit, uint32_t nodes=1)
virtual ~Ns2MobilityHelperTest ()
 Empty.
void AddReferencePoint (ReferencePoint const &r)
 Add next reference point.
void AddReferencePoint (const char *id, double sec, Vector const &p, Vector const &v)
 Sugar.
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)
- Public Member Functions inherited from ns3::TestCase
virtual ~TestCase ()

Private Member Functions

bool CheckInitialPositions ()
 Check that all initial positions are correct.
void CourseChange (std::string context, Ptr< const MobilityModel > mobility)
 Listen for course change events.
void CreateNodes ()
 Create and name nodes.
void DoRun ()
 Go.
void DoSetup ()
void DoTeardown ()
bool WriteTrace ()
 Dump NS-2 trace to tmp file.

Private Attributes

size_t m_nextRefPoint
 Next reference point to be checked.
uint32_t m_nodeCount
 Number of nodes used in the test.
std::vector< ReferencePointm_reference
 Reference mobility.
Time m_timeLimit
 Test time limit.
std::string m_trace
 Trace as string.
std::string m_traceFile
 TMP trace file name.

Additional Inherited Members

- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
void AddTestCase (TestCase *testCase)
 Add an individual test case to this test suite.
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)

Detailed Description

Every test case is supposed to:

  1. Generate short mobility trace file
  2. Read it back using Ns2MobilityHelper
  3. Check initial node positions and speeds.
  4. Run simulation listening for all CourseChange events and compare actual mobility with the reference

Definition at line 68 of file ns2-mobility-helper-test-suite.cc.

Constructor & Destructor Documentation

ns3::Ns2MobilityHelperTest::Ns2MobilityHelperTest ( std::string const &  name,
Time  timeLimit,
uint32_t  nodes = 1 
)
inline

Create new test case. To make it useful SetTrace () and AddReferencePoint () must be called

Parameters
nameShort description
timeLimitTest time limit
nodesNumber of nodes used in the test trace, 1 by default

Definition at line 99 of file ns2-mobility-helper-test-suite.cc.

virtual ns3::Ns2MobilityHelperTest::~Ns2MobilityHelperTest ( )
inlinevirtual

Empty.

Definition at line 107 of file ns2-mobility-helper-test-suite.cc.

Member Function Documentation

void ns3::Ns2MobilityHelperTest::AddReferencePoint ( ReferencePoint const &  r)
inline

Add next reference point.

Definition at line 116 of file ns2-mobility-helper-test-suite.cc.

References m_reference.

Referenced by AddReferencePoint(), and ns3::Ns2MobilityHelperTestSuite::Ns2MobilityHelperTestSuite().

+ Here is the caller graph for this function:

void ns3::Ns2MobilityHelperTest::AddReferencePoint ( const char *  id,
double  sec,
Vector const &  p,
Vector const &  v 
)
inline

Sugar.

Definition at line 121 of file ns2-mobility-helper-test-suite.cc.

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

+ Here is the call graph for this function:

bool ns3::Ns2MobilityHelperTest::CheckInitialPositions ( )
inlineprivate
void ns3::Ns2MobilityHelperTest::CourseChange ( std::string  context,
Ptr< const MobilityModel mobility 
)
inlineprivate
void ns3::Ns2MobilityHelperTest::CreateNodes ( )
inlineprivate

Create and name nodes.

Definition at line 152 of file ns2-mobility-helper-test-suite.cc.

References ns3::Names::Add(), ns3::NodeContainer::Create(), ns3::NodeContainer::Get(), and m_nodeCount.

Referenced by DoSetup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ns2MobilityHelperTest::DoRun ( void  )
inlineprivate
void ns3::Ns2MobilityHelperTest::DoSetup ( void  )
inlineprivate

Definition at line 206 of file ns2-mobility-helper-test-suite.cc.

References CreateNodes().

+ Here is the call graph for this function:

void ns3::Ns2MobilityHelperTest::DoTeardown ( void  )
inlineprivate

Definition at line 211 of file ns2-mobility-helper-test-suite.cc.

References ns3::Names::Clear(), ns3::Simulator::Destroy(), and m_traceFile.

+ Here is the call graph for this function:

void ns3::Ns2MobilityHelperTest::SetTrace ( std::string const &  trace)
inline

Set NS-2 trace to read as single large string (don't forget to add \n and quote "'s)

Definition at line 111 of file ns2-mobility-helper-test-suite.cc.

References m_trace.

Referenced by ns3::Ns2MobilityHelperTestSuite::Ns2MobilityHelperTestSuite().

+ Here is the caller graph for this function:

bool ns3::Ns2MobilityHelperTest::WriteTrace ( )
inlineprivate

Dump NS-2 trace to tmp file.

Definition at line 142 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

size_t ns3::Ns2MobilityHelperTest::m_nextRefPoint
private

Next reference point to be checked.

Definition at line 136 of file ns2-mobility-helper-test-suite.cc.

Referenced by CheckInitialPositions(), and CourseChange().

uint32_t ns3::Ns2MobilityHelperTest::m_nodeCount
private

Number of nodes used in the test.

Definition at line 130 of file ns2-mobility-helper-test-suite.cc.

Referenced by CreateNodes().

std::vector<ReferencePoint> ns3::Ns2MobilityHelperTest::m_reference
private

Reference mobility.

Definition at line 134 of file ns2-mobility-helper-test-suite.cc.

Referenced by AddReferencePoint(), CheckInitialPositions(), CourseChange(), and DoRun().

Time ns3::Ns2MobilityHelperTest::m_timeLimit
private

Test time limit.

Definition at line 128 of file ns2-mobility-helper-test-suite.cc.

Referenced by DoRun().

std::string ns3::Ns2MobilityHelperTest::m_trace
private

Trace as string.

Definition at line 132 of file ns2-mobility-helper-test-suite.cc.

Referenced by DoRun(), SetTrace(), and WriteTrace().

std::string ns3::Ns2MobilityHelperTest::m_traceFile
private

TMP trace file name.

Definition at line 138 of file ns2-mobility-helper-test-suite.cc.

Referenced by DoRun(), DoTeardown(), and WriteTrace().


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