KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_eda_angle.cpp File Reference
#include <cmath>
#include <iomanip>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <geometry/eda_angle.h>

Go to the source code of this file.

Classes

struct  EDA_ANGLE_NORMALISE_CASE
 

Functions

 BOOST_AUTO_TEST_CASE (Normalize)
 
 BOOST_AUTO_TEST_CASE (NormalizeHugeAndNonFinite)
 
static double refStep (double aValue, double aLow, bool aLowIncl, double aHigh, bool aHighIncl, double aPeriod)
 Reference copy of the stepping loops that normalization used before exact folding.
 
static bool refIsCardinal (double aValue)
 
static bool refIsCardinal90 (double aValue)
 
 BOOST_AUTO_TEST_CASE (NormalizeMatchesSteppingLoops)
 
 BOOST_AUTO_TEST_CASE (ConstantAngles)
 
 BOOST_AUTO_TEST_CASE (Snapped)
 
 BOOST_AUTO_TEST_CASE (Orientation)
 

Variables

static const std::vector< EDA_ANGLE_NORMALISE_CASE > normalize_cases
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/6]

BOOST_AUTO_TEST_CASE ( ConstantAngles )

◆ BOOST_AUTO_TEST_CASE() [2/6]

◆ BOOST_AUTO_TEST_CASE() [3/6]

◆ BOOST_AUTO_TEST_CASE() [4/6]

BOOST_AUTO_TEST_CASE ( NormalizeMatchesSteppingLoops )

◆ BOOST_AUTO_TEST_CASE() [5/6]

BOOST_AUTO_TEST_CASE ( Orientation )

Definition at line 258 of file test_eda_angle.cpp.

References ANGLE_180, EDA_ANGLE::AsDegrees(), BOOST_CHECK_EQUAL(), and DEGREES_T.

◆ BOOST_AUTO_TEST_CASE() [6/6]

BOOST_AUTO_TEST_CASE ( Snapped )

◆ refIsCardinal()

static bool refIsCardinal ( double aValue)
static

Definition at line 152 of file test_eda_angle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ refIsCardinal90()

static bool refIsCardinal90 ( double aValue)
static

Definition at line 164 of file test_eda_angle.cpp.

References std::abs().

Referenced by BOOST_AUTO_TEST_CASE().

◆ refStep()

static double refStep ( double aValue,
double aLow,
bool aLowIncl,
double aHigh,
bool aHighIncl,
double aPeriod )
static

Reference copy of the stepping loops that normalization used before exact folding.

They are exact at the magnitudes sampled here, so the folded versions must match them bit for bit, signed zero included.

Definition at line 140 of file test_eda_angle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

Variable Documentation

◆ normalize_cases

const std::vector<EDA_ANGLE_NORMALISE_CASE> normalize_cases
static
Initial value:
=
{
{ 90.0, 90.0, -270.0, 90.0, 90.0, 90.0 },
{ -90.0, 270.0, -90.0, -90.0, -90.0, -90.0 },
{ 135.0, 135.0, -225.0, -45.0, 135.0, 135.0 },
{ -135.0, 225.0, -135.0, 45.0, -135.0, -135.0 },
{ 180.0, 180.0, -180.0, 0.0, 180.0, 180.0 },
{ -180.0, 180.0, -180.0, 0.0, 180.0, -180.0 },
{ 360.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
{ -360.0, 0.0, 0.0, 0.0, 0.0, -360.0 },
{ 390.0, 30.0, -330.0, 30.0, 30.0, 30.0 },
{ -390.0, 330.0, -30.0, -30.0, -30.0, -30.0 },
{ 720.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
{ -720.0, 0.0, 0.0, 0.0, 0.0, -360.0 },
}

Definition at line 44 of file test_eda_angle.cpp.

Referenced by BOOST_AUTO_TEST_CASE().