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> 41 Room (uint32_t xx, uint32_t yy, uint32_t zz);
58 || ( (a.
x == b.
x) && (a.
y < b.
y) )
59 || ( (a.
x == b.
x) && (a.
y == b.
y) && (a.
z < b.
z) ));
70 virtual void DoRun (
void);
76 :
TestCase (
"RandomRoom, 12 rooms, 24 nodes")
98 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
100 mobility.SetPositionAllocator (positionAlloc);
102 BuildingsHelper::Install (
nodes);
104 BuildingsHelper::MakeMobilityModelConsistent ();
106 std::map<Room, uint32_t> roomCounter;
111 NS_ASSERT_MSG (mm,
"no mobility model aggregated to this node");
113 NS_ASSERT_MSG (bmm,
"MobilityBuildingInfo has not been aggregated to this node mobility model");
129 for (std::map<Room, uint32_t>::iterator it = roomCounter.begin (); it != roomCounter.end (); ++it)
139 Simulator::Destroy ();
152 virtual void DoRun (
void);
180 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
182 mobility.SetPositionAllocator (positionAlloc);
184 BuildingsHelper::Install (
nodes);
188 positionAlloc = CreateObject<SameRoomPositionAllocator> (
nodes);
189 mobility.SetPositionAllocator (positionAlloc);
191 BuildingsHelper::Install (copyNodes);
193 BuildingsHelper::MakeMobilityModelConsistent ();
195 std::map<Room, uint32_t> roomCounter;
200 NS_ASSERT_MSG (mm,
"no mobility model aggregated to this node");
202 NS_ASSERT_MSG (bmm,
"MobilityBuildingInfo has not been aggregated to this node mobility model");
209 for (std::map<Room, uint32_t>::iterator it = roomCounter.begin (); it != roomCounter.end (); ++it)
217 Simulator::Destroy ();
233 :
TestSuite (
"building-position-allocator", UNIT)
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetNRoomsY(uint16_t nroomy)
RandomRoomPositionAllocatorTestCase()
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
virtual void DoRun(void)
Implementation to actually run this TestCase.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
uint8_t GetFloorNumber(void)
uint8_t GetRoomNumberX(void)
Keep track of the current position and velocity of an object.
bool operator<(const Room &a, const Room &b)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void SetNFloors(uint16_t nfloors)
#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.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
SameRoomPositionAllocatorTestCase()
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
Vector GetPosition(void) const
Helper class used to assign positions and mobility models to nodes.
mobility buildings information (to be used by mobility models)
BuildingPositionAllocatorTestSuite()
void SetNRoomsX(uint16_t nroomx)
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
static BuildingPositionAllocatorTestSuite buildingsPositionAllocatorTestSuiteInstance
#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.
Room(uint32_t xx, uint32_t yy, uint32_t zz)
void SetBoundaries(Box box)
Set the boundaries of the building.
#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.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint8_t GetRoomNumberY(void)