18 #include <ns3/rectangle.h>
19 #include <ns3/simulator.h>
74 void DoRun()
override;
96 :
TestSuite(
"rectangle-closest-border", UNIT)
173 :
TestCase(BuildNameString(
x, y, rectangle, side)),
176 m_rectangle(rectangle),
191 std::ostringstream oss;
192 oss <<
"Rectangle closest border test : checking"
193 <<
" (x,y) = (" <<
x <<
"," << y <<
") closest border to the rectangle [(" << rectangle.
xMin
194 <<
", " << rectangle.
yMin <<
"), (" << rectangle.
xMax <<
", " << rectangle.
yMax
195 <<
")]. The expected side = " << side;
202 Vector position(
m_x,
m_y, 0.0);
206 Simulator::Destroy();
TestCase to check the rectangle line intersection.
std::string BuildNameString(double x, double y, Rectangle rectangle, Rectangle::Side side)
Builds the test name string based on provided parameter values.
Rectangle::Side m_side
Flag to indicate the intersection.
double m_x
X coordinate of the point to be tested.
double m_y
Y coordinate of the point to be tested.
RectangleClosestBorderTestCase(double x, double y, Rectangle rectangle, Rectangle::Side side)
Create RectangleClosestBorderTestCase.
~RectangleClosestBorderTestCase() override
Destructor.
void DoRun() override
Setup the simulation according to the configuration set by the class constructor, run it,...
Rectangle m_rectangle
The rectangle to check the intersection with.
Rectangle detection of closest border to a point, inside or outside.
RectangleClosestBorderTestSuite()
Constructor.
double yMax
The y coordinate of the top bound of the rectangle.
Side GetClosestSideOrCorner(const Vector &position) const
double xMax
The x coordinate of the right bound of the rectangle.
Side
enum for naming sides
double xMin
The x coordinate of the left bound of the rectangle.
double yMin
The y coordinate of the bottom bound of the rectangle.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
static RectangleClosestBorderTestSuite rectangleClosestBorderTestSuite
Static variable for test initialization.
#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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.