25 #include <ns3/building-position-allocator.h>
26 #include <ns3/mobility-building-info.h>
27 #include <ns3/constant-position-mobility-model.h>
28 #include <ns3/mobility-model.h>
29 #include <ns3/building.h>
30 #include <ns3/buildings-helper.h>
31 #include <ns3/mobility-helper.h>
32 #include <ns3/simulator.h>
58 Room (uint32_t xx, uint32_t yy, uint32_t zz);
75 || ( (a.
x == b.
x) && (a.
y < b.
y) )
76 || ( (a.
x == b.
x) && (a.
y == b.
y) && (a.
z < b.
z) ));
92 virtual void DoRun (
void);
98 :
TestCase (
"RandomRoom, 12 rooms, 24 nodes")
111 b->SetBoundaries (
Box (1, 3, 1, 4, 1, 3));
120 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
122 mobility.SetPositionAllocator (positionAlloc);
124 BuildingsHelper::Install (
nodes);
126 std::map<Room, uint32_t> roomCounter;
131 NS_ASSERT_MSG (mm,
"no mobility model aggregated to this node");
133 NS_ASSERT_MSG (bmm,
"MobilityBuildingInfo has not been aggregated to this node mobility model");
136 Room r (bmm->GetRoomNumberX (), bmm->GetRoomNumberY (), bmm->GetFloorNumber ());
149 for (std::map<Room, uint32_t>::iterator it = roomCounter.begin (); it != roomCounter.end (); ++it)
159 Simulator::Destroy ();
176 virtual void DoRun (
void);
195 b->SetBoundaries (
Box (-10, -6, 20, 26, -1, 5));
204 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
206 mobility.SetPositionAllocator (positionAlloc);
208 BuildingsHelper::Install (
nodes);
212 positionAlloc = CreateObject<SameRoomPositionAllocator> (
nodes);
213 mobility.SetPositionAllocator (positionAlloc);
215 BuildingsHelper::Install (copyNodes);
217 std::map<Room, uint32_t> roomCounter;
222 NS_ASSERT_MSG (mm,
"no mobility model aggregated to this node");
224 NS_ASSERT_MSG (bmm,
"MobilityBuildingInfo has not been aggregated to this node mobility model");
227 Room r (bmm->GetRoomNumberX (), bmm->GetRoomNumberY (), bmm->GetFloorNumber ());
231 for (std::map<Room, uint32_t>::iterator it = roomCounter.begin (); it != roomCounter.end (); ++it)
239 Simulator::Destroy ();
256 :
TestSuite (
"building-position-allocator", UNIT)
bool operator<(const Room &a, const Room &b)
static BuildingPositionAllocatorTestSuite buildingsPositionAllocatorTestSuiteInstance
Static variable for test initialization.
RandomRoomPositionAllocator TestSuite.
BuildingPositionAllocatorTestSuite()
RandomRoomPositionAllocator test.
RandomRoomPositionAllocatorTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
SameRoomPositionAllocator test.
virtual void DoRun(void)
Implementation to actually run this TestCase.
SameRoomPositionAllocatorTestCase()
mobility buildings information (to be used by mobility models)
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
Vector GetPosition(void) const
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
list x
Random number samples.
uint32_t z
Z coord (floor)
Room(uint32_t xx, uint32_t yy, uint32_t zz)
Constructor.