A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
RectangleClosestBorderTestCase Class Reference

TestCase to check the rectangle line intersection. More...

+ Inheritance diagram for RectangleClosestBorderTestCase:
+ Collaboration diagram for RectangleClosestBorderTestCase:

Public Member Functions

 RectangleClosestBorderTestCase (double x, double y, Rectangle rectangle, Rectangle::Side side)
 Create RectangleClosestBorderTestCase.
 
 ~RectangleClosestBorderTestCase () override
 Destructor.
 
std::string BuildNameString (double x, double y, Rectangle rectangle, Rectangle::Side side)
 Builds the test name string based on provided parameter values.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

void DoRun () override
 Setup the simulation according to the configuration set by the class constructor, run it, and verify the result.
 

Private Attributes

Rectangle m_rectangle
 The rectangle to check the intersection with.
 
Rectangle::Side m_side {ns3::Rectangle::TOPSIDE}
 Flag to indicate the intersection.
 
double m_x {0.0}
 X coordinate of the point to be tested.
 
double m_y {0.0}
 Y coordinate of the point to be tested.
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto QUICK = Duration::QUICK
 Deprecated test duration simple enums.
 
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto TAKES_FOREVER = Duration::TAKES_FOREVER
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

TestCase to check the rectangle line intersection.

Definition at line 32 of file rectangle-closest-border-test.cc.

Constructor & Destructor Documentation

◆ RectangleClosestBorderTestCase()

RectangleClosestBorderTestCase::RectangleClosestBorderTestCase ( double x,
double y,
Rectangle rectangle,
Rectangle::Side side )

Create RectangleClosestBorderTestCase.

Parameters
xIndex of the first position to generate
yIndex of the second position to generate
rectangleThe 2D rectangle
sideThe expected result of the test

Definition at line 158 of file rectangle-closest-border-test.cc.

◆ ~RectangleClosestBorderTestCase()

RectangleClosestBorderTestCase::~RectangleClosestBorderTestCase ( )
override

Destructor.

Definition at line 170 of file rectangle-closest-border-test.cc.

Member Function Documentation

◆ BuildNameString()

std::string RectangleClosestBorderTestCase::BuildNameString ( double x,
double y,
Rectangle rectangle,
Rectangle::Side side )

Builds the test name string based on provided parameter values.

Parameters
xIndex of the first position to generate
yIndex of the second position to generate
rectangleThe 2D rectangle
sideThe expected result of the test
Returns
The name string

Definition at line 175 of file rectangle-closest-border-test.cc.

References ns3::Rectangle::xMax, ns3::Rectangle::xMin, ns3::Rectangle::yMax, and ns3::Rectangle::yMin.

◆ DoRun()

void RectangleClosestBorderTestCase::DoRun ( )
overrideprivatevirtual

Setup the simulation according to the configuration set by the class constructor, run it, and verify the result.

Implements ns3::TestCase.

Definition at line 189 of file rectangle-closest-border-test.cc.

References ns3::Simulator::Destroy(), ns3::Rectangle::GetClosestSideOrCorner(), m_rectangle, m_side, m_x, m_y, and NS_TEST_ASSERT_MSG_EQ.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_rectangle

Rectangle RectangleClosestBorderTestCase::m_rectangle
private

The rectangle to check the intersection with.

Definition at line 67 of file rectangle-closest-border-test.cc.

Referenced by DoRun().

◆ m_side

Rectangle::Side RectangleClosestBorderTestCase::m_side {ns3::Rectangle::TOPSIDE}
private

Flag to indicate the intersection.

True, for intersection, false otherwise.

Definition at line 73 of file rectangle-closest-border-test.cc.

Referenced by DoRun().

◆ m_x

double RectangleClosestBorderTestCase::m_x {0.0}
private

X coordinate of the point to be tested.

Definition at line 65 of file rectangle-closest-border-test.cc.

Referenced by DoRun().

◆ m_y

double RectangleClosestBorderTestCase::m_y {0.0}
private

Y coordinate of the point to be tested.

Definition at line 66 of file rectangle-closest-border-test.cc.

Referenced by DoRun().


The documentation for this class was generated from the following file: