KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_circle.cpp File Reference

Go to the source code of this file.

Classes

struct  CIR_PT_BOOL_CASE
 Struct to hold test cases for a given circle, a point and an expected return boolean. More...
 
struct  CIR_PT_PT_CASE
 Struct to hold test cases for a given circle, a point and an expected return point. More...
 
struct  CIR_CIR_VECPT_CASE
 Struct to hold test cases for two circles, and an vector of points. More...
 
struct  SEG_SEG_VECPT_CASE
 Struct to hold test cases for a circle, a line and an expected vector of points. More...
 
struct  CIR_SEG_VECPT_CASE
 Struct to hold test cases for two lines, a point and an expected returned circle. More...
 

Functions

bool CompareLength (int aLengthA, int aLengthB)
 
bool CompareVector2I (const VECTOR2I &aVecA, const VECTOR2I &aVecB)
 
 BOOST_AUTO_TEST_CASE (ParameterCtorMod)
 Checks whether the construction of a circle referencing external parameters works and that the parameters can be modified directly.
 
 BOOST_AUTO_TEST_CASE (Contains)
 
 BOOST_AUTO_TEST_CASE (NearestPoint)
 
 BOOST_AUTO_TEST_CASE (IntersectCircle)
 
 BOOST_AUTO_TEST_CASE (Intersect)
 
 BOOST_AUTO_TEST_CASE (IntersectLine)
 
 BOOST_AUTO_TEST_CASE (ConstructFromTanTanPt)
 

Variables

const int MIN_PRECISION_45DEG = KiROUND( (double) SHAPE::MIN_PRECISION_IU * 0.7071 )
 
static const std::vector< CIR_PT_BOOL_CASEcontains_cases
 Test cases for CIRCLE::Contains.
 
static const std::vector< CIR_PT_PT_CASEnearest_point_cases
 Test cases for CIRCLE::NearestPoint.
 
static const std::vector< CIR_CIR_VECPT_CASEintersect_circle_cases
 Test cases for #CIRCLE::Intersect( const CIRCLE& aCircle )
 
static const std::vector< SEG_SEG_VECPT_CASEintersect_seg_cases
 Test cases for #CIRCLE::Intersect( const SEG& aSeg )
 
static const std::vector< SEG_SEG_VECPT_CASEintersect_line_cases
 Test cases for #CIRCLE::IntersectLine( const SEG& aSeg )
 
static const std::vector< CIR_SEG_VECPT_CASEconstruct_tan_tan_pt_cases
 Test cases for #CIRCLE::Intersect( const SEG& aSeg )
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/7]

BOOST_AUTO_TEST_CASE ( ConstructFromTanTanPt  )

◆ BOOST_AUTO_TEST_CASE() [2/7]

BOOST_AUTO_TEST_CASE ( Contains  )

Definition at line 168 of file test_circle.cpp.

References BOOST_TEST_CONTEXT, and contains_cases.

◆ BOOST_AUTO_TEST_CASE() [3/7]

BOOST_AUTO_TEST_CASE ( Intersect  )

◆ BOOST_AUTO_TEST_CASE() [4/7]

BOOST_AUTO_TEST_CASE ( IntersectCircle  )

◆ BOOST_AUTO_TEST_CASE() [5/7]

BOOST_AUTO_TEST_CASE ( IntersectLine  )

◆ BOOST_AUTO_TEST_CASE() [6/7]

BOOST_AUTO_TEST_CASE ( NearestPoint  )

Definition at line 226 of file test_circle.cpp.

References BOOST_TEST_CONTEXT, and nearest_point_cases.

◆ BOOST_AUTO_TEST_CASE() [7/7]

BOOST_AUTO_TEST_CASE ( ParameterCtorMod  )

Checks whether the construction of a circle referencing external parameters works and that the parameters can be modified directly.

Definition at line 55 of file test_circle.cpp.

References CIRCLE::Center, and CIRCLE::Radius.

◆ CompareLength()

bool CompareLength ( int  aLengthA,
int  aLengthB 
)

Definition at line 28 of file test_circle.cpp.

References SHAPE::MIN_PRECISION_IU.

Referenced by BOOST_AUTO_TEST_CASE(), and CompareVector2I().

◆ CompareVector2I()

bool CompareVector2I ( const VECTOR2I aVecA,
const VECTOR2I aVecB 
)

Definition at line 38 of file test_circle.cpp.

References CompareLength(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BOOST_AUTO_TEST_CASE().

Variable Documentation

◆ construct_tan_tan_pt_cases

const std::vector<CIR_SEG_VECPT_CASE> construct_tan_tan_pt_cases
static

Test cases for #CIRCLE::Intersect( const SEG& aSeg )

Definition at line 522 of file test_circle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ contains_cases

const std::vector<CIR_PT_BOOL_CASE> contains_cases
static

Test cases for CIRCLE::Contains.

Definition at line 91 of file test_circle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ intersect_circle_cases

const std::vector<CIR_CIR_VECPT_CASE> intersect_circle_cases
static

Test cases for #CIRCLE::Intersect( const CIRCLE& aCircle )

Definition at line 254 of file test_circle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ intersect_line_cases

const std::vector<SEG_SEG_VECPT_CASE> intersect_line_cases
static

Test cases for #CIRCLE::IntersectLine( const SEG& aSeg )

Definition at line 443 of file test_circle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ intersect_seg_cases

const std::vector<SEG_SEG_VECPT_CASE> intersect_seg_cases
static

Test cases for #CIRCLE::Intersect( const SEG& aSeg )

Definition at line 378 of file test_circle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ MIN_PRECISION_45DEG

const int MIN_PRECISION_45DEG = KiROUND( (double) SHAPE::MIN_PRECISION_IU * 0.7071 )

Definition at line 26 of file test_circle.cpp.

◆ nearest_point_cases

const std::vector<CIR_PT_PT_CASE> nearest_point_cases
static
Initial value:
= {
{
"on center",
{ { 10, 10 }, 20 },
{ 10, 10 },
{ 30, 10 },
},
{
"inside",
{ { 10, 10 }, 20 },
{ 10, 20 },
{ 10, 30 },
},
{
"outside",
{ { 10, 10 }, 20 },
{ 10, 50 },
{ 10, 30 },
},
{
"angled",
{ { 10, 10 }, 20 },
{ 50, 50 },
{ 24, 24 },
},
}

Test cases for CIRCLE::NearestPoint.

Definition at line 197 of file test_circle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().