14#include "ns3/boolean.h"
15#include "ns3/mobility-helper.h"
16#include "ns3/mobility-model.h"
17#include "ns3/scheduler.h"
18#include "ns3/simulator.h"
20#include "ns3/vector.h"
21#include "ns3/waypoint-mobility-model.h"
49 void DoRun()
override;
56 :
TestCase(
"Test behavior when LazyNotify is false"),
68 Vector pos =
m_mob->GetPosition();
79 "Course change not notified correctly");
91 m_mob->AddWaypoint(wpt);
93 m_mob->AddWaypoint(wpt2);
95 m_mob->AddWaypoint(wpt3);
125 void DoRun()
override;
131 :
TestCase(
"Test behavior when LazyNotify is true")
142 Vector pos =
m_mob->GetPosition();
154 "Course change not notified correctly");
165 m_mob->AddWaypoint(wpt);
167 m_mob->AddWaypoint(wpt2);
169 m_mob->AddWaypoint(wpt3);
200 void DoRun()
override;
209 :
TestCase(
"Test behavior of Waypoint InitialPositionIsWaypoint")
221 Vector pos = model->GetPosition();
240 m_mob1->SetPosition(Vector(10.0, 10.0, 10.0));
259 m_mob2->AddWaypoint(wpt21);
261 m_mob2->AddWaypoint(wpt22);
262 m_mob2->SetPosition(Vector(10.0, 10.0, 10.0));
293 m_mob3->SetPosition(Vector(10.0, 10.0, 10.0));
312 m_mob4->AddWaypoint(wpt41);
314 m_mob4->AddWaypoint(wpt42);
318 m_mob4->SetPosition(Vector(10.0, 10.0, 10.0));
351 m_mob5->AddWaypoint(wpt51);
353 m_mob5->AddWaypoint(wpt52);
355 m_mob5->AddWaypoint(wpt53);
358 m_mob5->SetPosition(Vector(10.0, 10.0, 10.0));
387 void DoRun()
override;
391 :
TestCase(
"Test behavior using MobilityHelper and PositionAllocator")
403 Vector pos = mob->GetPosition();
415 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
416 mobility.SetPositionAllocator(positionAlloc);
420 mobility.SetMobilityModel(
"ns3::WaypointMobilityModel",
421 "InitialPositionIsWaypoint",
430 mob->AddWaypoint(wpt);
431 mob->AddWaypoint(wpt2);
448 positionAlloc2->Add(Vector(0.0, 0.0, 0.0));
451 "InitialPositionIsWaypoint",
456 mob2->AddWaypoint(wpt3);
Waypoint Initial Position Is Waypoint Test.
Ptr< WaypointMobilityModel > m_mob4
mobility model 4
Ptr< WaypointMobilityModel > m_mob5
mobility model 5
WaypointInitialPositionIsWaypoint()
void DoRun() override
Implementation to actually run this TestCase.
Ptr< WaypointMobilityModel > m_mob2
mobility model 2
~WaypointInitialPositionIsWaypoint() override
Ptr< WaypointMobilityModel > m_mob1
mobility model 1
void TestNumWaypoints(Ptr< const WaypointMobilityModel > model, uint32_t num)
Test number of way points.
void TestXPosition(Ptr< const WaypointMobilityModel > model, double expectedXPos)
Text X position function.
Ptr< WaypointMobilityModel > m_mob3
mobility model 3
Test whether course change notifications occur regardless of calls to Update() position (which are tr...
~WaypointLazyNotifyFalse() override
void CourseChangeCallback(std::string path, Ptr< const MobilityModel > model)
Course change callback.
WaypointLazyNotifyFalse()
void TestXPosition(double expectedXPos)
Test X position function.
int m_courseChanges
course changes
void DoRun() override
Implementation to actually run this TestCase.
Ptr< WaypointMobilityModel > m_mob
modility model
Waypoint Lazy Notify True.
void TestXPosition(double expectedXPos)
Text X position function.
Ptr< WaypointMobilityModel > m_mob
modility model
void DoRun() override
Implementation to actually run this TestCase.
~WaypointLazyNotifyTrue() override
void CourseChangeCallback(std::string path, Ptr< const MobilityModel > model)
Course change callback.
Waypoint Mobility Model Via Helper Test.
void DoRun() override
Implementation to actually run this TestCase.
WaypointMobilityModelViaHelper()
~WaypointMobilityModelViaHelper() override
void TestXPosition(Ptr< const WaypointMobilityModel > mob, double expectedXPos)
Text X position function.
Helper class used to assign positions and mobility models to nodes.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void SetMobilityModel(std::string type, Ts &&... args)
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Waypoint-based mobility model.
static MobilityTestSuite mobilityTestSuite
Static variable for test initialization.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.