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

Test suite for ARRAY_OPTIONS. More...

Go to the source code of this file.

Classes

struct  GRID_ARRAY_GEOM_PARAMS
 Declare the test suite. More...
 
struct  GRID_ARRAY_TEST_CASE
 
struct  CIRC_ARRAY_GEOM_PARAMS
 
struct  CIRC_ARRAY_TEST_CASE
 
struct  GRID_ARRAY_NAMING_PARAMS
 
struct  GRID_ARRAY_NAMING_CASE
 

Functions

std::ostream & boost_test_print_type (std::ostream &os, const ARRAY_OPTIONS::TRANSFORM &aObj)
 Define a stream function for logging this type.
 
bool TransformIsClose (const ARRAY_OPTIONS::TRANSFORM &aL, const ARRAY_OPTIONS::TRANSFORM &aR)
 Predicate to see if a ARRAY_OPTIONS::TRANSFORM is equal or nearly equal.
 
void CheckArrayTransforms (const ARRAY_OPTIONS &aOpts, const VECTOR2I &aPos, const std::vector< ARRAY_OPTIONS::TRANSFORM > &aExp)
 Generate all array transforms for an array descriptor and compare against a list of expected transforms.
 
 BOOST_AUTO_TEST_CASE (GridGeometry)
 Test of grid array geometry.
 
 BOOST_AUTO_TEST_CASE (CircularGeometry)
 Test of circular array geometry.
 
void CheckArrayNumbering (const ARRAY_OPTIONS &aOpts, const std::vector< std::string > &aExp)
 Generate all array names and check against expected.
 
 BOOST_AUTO_TEST_CASE (GridNaming)
 Test of grid array geometry.
 

Variables

static const std::vector< GRID_ARRAY_TEST_CASEgrid_geom_cases
 
static const std::vector< CIRC_ARRAY_TEST_CASEcirc_geom_cases
 
static const std::vector< GRID_ARRAY_NAMING_CASEgrid_name_cases
 

Detailed Description

Test suite for ARRAY_OPTIONS.

Definition in file test_array_options.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

BOOST_AUTO_TEST_CASE ( CircularGeometry  )

◆ BOOST_AUTO_TEST_CASE() [2/3]

◆ BOOST_AUTO_TEST_CASE() [3/3]

◆ boost_test_print_type()

std::ostream & boost_test_print_type ( std::ostream &  os,
const ARRAY_OPTIONS::TRANSFORM aObj 
)

Define a stream function for logging this type.

Definition at line 40 of file test_array_options.cpp.

References EDA_ANGLE::AsDegrees(), ARRAY_OPTIONS::TRANSFORM::m_offset, and ARRAY_OPTIONS::TRANSFORM::m_rotation.

◆ CheckArrayNumbering()

void CheckArrayNumbering ( const ARRAY_OPTIONS aOpts,
const std::vector< std::string > &  aExp 
)

Generate all array names and check against expected.

Parameters
aOptsthe array descriptor
aExpexpected name list

Definition at line 379 of file test_array_options.cpp.

References ARRAY_OPTIONS::GetArraySize(), and ARRAY_OPTIONS::GetItemNumber().

Referenced by BOOST_AUTO_TEST_CASE().

◆ CheckArrayTransforms()

void CheckArrayTransforms ( const ARRAY_OPTIONS aOpts,
const VECTOR2I aPos,
const std::vector< ARRAY_OPTIONS::TRANSFORM > &  aExp 
)

Generate all array transforms for an array descriptor and compare against a list of expected transforms.

Parameters
aOptsthe array descriptor
aPosthe position of the reference item
aExpexpected transform list

Definition at line 66 of file test_array_options.cpp.

References ARRAY_OPTIONS::GetArraySize(), ARRAY_OPTIONS::GetTransform(), and TransformIsClose().

Referenced by BOOST_AUTO_TEST_CASE().

◆ TransformIsClose()

bool TransformIsClose ( const ARRAY_OPTIONS::TRANSFORM aL,
const ARRAY_OPTIONS::TRANSFORM aR 
)

Predicate to see if a ARRAY_OPTIONS::TRANSFORM is equal or nearly equal.

Definition at line 51 of file test_array_options.cpp.

References EDA_ANGLE::AsDegrees(), ARRAY_OPTIONS::TRANSFORM::m_offset, and ARRAY_OPTIONS::TRANSFORM::m_rotation.

Referenced by CheckArrayTransforms().

Variable Documentation

◆ circ_geom_cases

const std::vector<CIRC_ARRAY_TEST_CASE> circ_geom_cases
static

Definition at line 300 of file test_array_options.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ grid_geom_cases

const std::vector<GRID_ARRAY_TEST_CASE> grid_geom_cases
static

Definition at line 116 of file test_array_options.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ grid_name_cases

const std::vector<GRID_ARRAY_NAMING_CASE> grid_name_cases
static

Definition at line 414 of file test_array_options.cpp.

Referenced by BOOST_AUTO_TEST_CASE().