25 #include "ns3/boolean.h"
26 #include "ns3/mobility-helper.h"
27 #include "ns3/mobility-model.h"
28 #include "ns3/scheduler.h"
29 #include "ns3/simulator.h"
31 #include "ns3/vector.h"
32 #include "ns3/waypoint-mobility-model.h"
53 void TestXPosition(
double expectedXPos);
60 void DoRun()
override;
67 :
TestCase(
"Test behavior when LazyNotify is false"),
90 "Course change not notified correctly");
97 m_node = CreateObject<Node>();
98 m_mob = CreateObject<WaypointMobilityModel>();
110 Simulator::Destroy();
136 void DoRun()
override;
142 :
TestCase(
"Test behavior when LazyNotify is true")
165 "Course change not notified correctly");
171 m_node = CreateObject<Node>();
172 m_mob = CreateObject<WaypointMobilityModel>();
184 Simulator::Destroy();
211 void DoRun()
override;
220 :
TestCase(
"Test behavior of Waypoint InitialPositionIsWaypoint")
232 Vector pos = model->GetPosition();
249 m_mob1 = CreateObject<WaypointMobilityModel>();
253 Simulator::Schedule(
Seconds(1.0),
259 Simulator::Schedule(
Seconds(15.0),
267 m_mob2 = CreateObject<WaypointMobilityModel>();
276 Simulator::Schedule(
Seconds(3.0),
281 Simulator::Schedule(
Seconds(3.0),
289 Simulator::Schedule(
Seconds(8.0),
294 Simulator::Schedule(
Seconds(8.0),
302 m_mob3 = CreateObject<WaypointMobilityModel>();
306 Simulator::Schedule(
Seconds(1.0),
312 Simulator::Schedule(
Seconds(15.0),
320 m_mob4 = CreateObject<WaypointMobilityModel>();
331 Simulator::Schedule(
Seconds(3.0),
336 Simulator::Schedule(
Seconds(3.0),
342 Simulator::Schedule(
Seconds(6.0),
348 Simulator::Schedule(
Seconds(15.0),
356 m_mob5 = CreateObject<WaypointMobilityModel>();
370 Simulator::Schedule(
Seconds(3.0),
377 Simulator::Destroy();
398 void DoRun()
override;
402 :
TestCase(
"Test behavior using MobilityHelper and PositionAllocator")
414 Vector pos = mob->GetPosition();
426 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
427 mobility.SetPositionAllocator(positionAlloc);
431 mobility.SetMobilityModel(
"ns3::WaypointMobilityModel",
432 "InitialPositionIsWaypoint",
446 Simulator::Schedule(
Seconds(7.5),
459 positionAlloc2->Add(Vector(0.0, 0.0, 0.0));
462 "InitialPositionIsWaypoint",
472 Simulator::Destroy();
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...
Vector GetPosition() const
void SetPosition(const Vector &position)
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.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
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.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Waypoint-based mobility model.
void AddWaypoint(const Waypoint &waypoint)
static MobilityTestSuite mobilityTestSuite
Static variable for test initialization.
Time Now()
create an ns3::Time instance which contains the current simulation time.
#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.
static void CourseChangeCallback(std::string path, Ptr< const MobilityModel > model)
This function will be used below as a trace sink, if the command-line argument or default value "useC...
Every class exported by the ns3 library is enclosed in the ns3 namespace.