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

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

#include "box-line-intersection-test.h"

+ Inheritance diagram for BoxLineIntersectionTestCase:
+ Collaboration diagram for BoxLineIntersectionTestCase:

Public Member Functions

 BoxLineIntersectionTestCase (uint16_t indexPos1, uint16_t indexPos2, Box box, bool intersect)
 Create BoxLineIntersectionTestCase.
 
 ~BoxLineIntersectionTestCase () override
 Destructor.
 
std::string BuildNameString (uint16_t indexPos1, uint16_t indexPos2, Box box, bool intersect)
 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

Vector CreatePosition (uint16_t index, double boxHeight)
 Create the position as per the given index.
 
void DoRun () override
 Setup the simulation according to the configuration set by the class constructor, run it, and verify the result.
 

Private Attributes

Box m_box
 The box to check the intersection with.
 
uint16_t m_indexPos1 {0}
 First position index.
 
uint16_t m_indexPos2 {0}
 Second position index.
 
bool m_intersect {false}
 Flag to indicate the intersection.
 

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 box line intersection.

Definition at line 34 of file box-line-intersection-test.h.

Constructor & Destructor Documentation

◆ BoxLineIntersectionTestCase()

BoxLineIntersectionTestCase::BoxLineIntersectionTestCase ( uint16_t indexPos1,
uint16_t indexPos2,
Box box,
bool intersect )

Create BoxLineIntersectionTestCase.

TestCase.

Parameters
indexPos1Index of the first position to generate
indexPos2Index of the second position to generate
boxThe 3D box
intersectThe expected result of the test. True for intersection, false otherwise

Definition at line 64 of file box-line-intersection-test.cc.

◆ ~BoxLineIntersectionTestCase()

BoxLineIntersectionTestCase::~BoxLineIntersectionTestCase ( )
override

Destructor.

Definition at line 76 of file box-line-intersection-test.cc.

Member Function Documentation

◆ BuildNameString()

std::string BoxLineIntersectionTestCase::BuildNameString ( uint16_t indexPos1,
uint16_t indexPos2,
Box box,
bool intersect )

Builds the test name string based on provided parameter values.

Parameters
indexPos1Index of the first position to generate
indexPos2Index of the second position to generate
boxThe 3D box
intersectThe expected result of the test. True for intersection, false otherwise
Returns
The name string

Definition at line 81 of file box-line-intersection-test.cc.

References ns3::Box::xMax, ns3::Box::xMin, ns3::Box::yMax, ns3::Box::yMin, ns3::Box::zMax, and ns3::Box::zMin.

◆ CreatePosition()

Vector BoxLineIntersectionTestCase::CreatePosition ( uint16_t index,
double boxHeight )
private

Create the position as per the given index.

Parameters
indexThe index of the position to be created
boxHeightThe height if the box. It is used to place the position above the height of the box
Returns
The ns-3 3D Vector specifying the position

Definition at line 110 of file box-line-intersection-test.cc.

References NS_FATAL_ERROR.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ DoRun()

void BoxLineIntersectionTestCase::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 96 of file box-line-intersection-test.cc.

References CreatePosition(), ns3::Simulator::Destroy(), ns3::Box::IsIntersect(), m_box, m_indexPos1, m_indexPos2, m_intersect, NS_TEST_ASSERT_MSG_EQ, ns3::Box::zMax, and ns3::Box::zMin.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_box

Box BoxLineIntersectionTestCase::m_box
private

The box to check the intersection with.

Definition at line 80 of file box-line-intersection-test.h.

Referenced by DoRun().

◆ m_indexPos1

uint16_t BoxLineIntersectionTestCase::m_indexPos1 {0}
private

First position index.

Definition at line 78 of file box-line-intersection-test.h.

Referenced by DoRun().

◆ m_indexPos2

uint16_t BoxLineIntersectionTestCase::m_indexPos2 {0}
private

Second position index.

Definition at line 79 of file box-line-intersection-test.h.

Referenced by DoRun().

◆ m_intersect

bool BoxLineIntersectionTestCase::m_intersect {false}
private

Flag to indicate the intersection.

True, for intersection, false otherwise.

Definition at line 81 of file box-line-intersection-test.h.

Referenced by DoRun().


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