21 #include <ns3/simulator.h> 35 :
TestSuite (
"box-line-intersection", UNIT)
38 Box box =
Box (890.0, 990.0, 840.0, 870.0, 0.0, 6.0);
78 :
TestCase (BuildNameString (indexPos1, indexPos2, box, intersect)),
79 m_indexPos1 (indexPos1),
80 m_indexPos2 (indexPos2),
82 m_intersect (intersect)
93 std::ostringstream oss;
94 oss <<
"Box line intersection test : checking" 95 <<
" pos1 index " << indexPos1 <<
" and pos2 index " << indexPos2
96 <<
" intersection with the box (" << box.
xMin <<
", " << box.
xMax 97 <<
", " << box.
yMin <<
", " << box.
yMax 98 <<
", " << box.
zMin <<
", " << box.
zMax 99 <<
"). The expected intersection flag = " << intersect <<
" ";
113 Simulator::Destroy ();
124 pos = Vector (934.0, 852.0, 1.5);
127 pos = Vector (931.0,861.0, 1.5);
130 pos = Vector (484.0, 298.0, 1.5);
133 pos = Vector (1000.0, 850.0, 1.5);
136 pos = Vector (850.0, 850.0, 1.5);
139 pos = Vector (934.0, 852.0, boxHeight + 14.0);
double zMin
The z coordinate of the down bound of the box.
uint16_t m_indexPos1
First position index.
virtual ~BoxLineIntersectionTestCase()
Destructor.
BoxLineIntersectionTestCase(uint16_t indexPos1, uint16_t indexPos2, Box box, bool intersect)
Create BoxLineIntersectionTestCase.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
double xMax
The x coordinate of the right bound of the box.
double yMax
The y coordinate of the top bound of the box.
bool IsIntersect(const Vector &l1, const Vector &l2) const
Checks if a line-segment between position l1 and position l2 intersects a box.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#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.
uint16_t m_indexPos2
Second position index.
double yMin
The y coordinate of the bottom bound of the box.
TestCase to check the box line intersection.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string BuildNameString(uint16_t indexPos1, uint16_t indexPos2, Box box, bool intersect)
Builds the test name string based on provided parameter values.
double zMax
The z coordinate of the up bound of the box.
static BoxLineIntersectionTestSuite boxLineIntersectionTestSuite
boxLineIntersectionTestSuite
Vector CreatePosition(uint16_t index, double boxHeight)
Create the position as per the given index.
BoxLineIntersectionTestSuite()
Constructor.
virtual void DoRun(void)
Setup the simulation according to the configuration set by the class constructor, run it...
Box m_box
The box to check the intersection with.
bool m_intersect
Flag to indicate the intersection.
double xMin
The x coordinate of the left bound of the box.