KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_expectations.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include "pcbnew_utils/board_expectations.h"
#include <optional>
#include <board.h>
#include <pcb_shape.h>

Go to the source code of this file.

Classes

class  INT_MATCHER
 Simple binary expectation that checks if an integer value meets the expectation (exact, at least, at most). More...
 
class  STRING_PATTERN_MATCHER
 Glob-like pattern matcher for strings, supporting '*' and '? More...
 
class  FOOTPRINT_EXPECTATION
 
class  NET_EXPECTATION
 
class  LAYER_EXPECTATION
 
class  CIRCLE_EXPECTATION
 

Functions

static std::unique_ptr< BOARD_EXPECTATIONcreateFootprintExpectation (const nlohmann::json &aExpectationEntry)
 
static std::vector< std::string > getStringArray (const nlohmann::json &aJson)
 
static std::unique_ptr< BOARD_EXPECTATIONcreateNetExpectation (const nlohmann::json &aExpectationEntry)
 
static std::unique_ptr< BOARD_EXPECTATIONcreateLayerExpectation (const nlohmann::json &aExpectationEntry)
 
static int parsePcbDim (const nlohmann::json &aJson)
 Parse a dimension from JSON, which can be either an integer (in mm) or a string with units (e.g.
 
static int parsePcbDim (const nlohmann::json &aJson, const std::string &aFieldName)
 
static VECTOR2I parsePosition (const nlohmann::json &aJson, const std::string &aFieldName)
 
static std::unique_ptr< BOARD_EXPECTATIONcreateCircleExpectation (const nlohmann::json &aExpectationEntry)
 
static std::unique_ptr< BOARD_EXPECTATIONcreateGraphicExpectation (const nlohmann::json &aExpectationEntry)
 

Function Documentation

◆ createCircleExpectation()

static std::unique_ptr< BOARD_EXPECTATION > createCircleExpectation ( const nlohmann::json & aExpectationEntry)
static

Definition at line 555 of file board_expectations.cpp.

References parsePcbDim(), and parsePosition().

Referenced by createGraphicExpectation().

◆ createFootprintExpectation()

static std::unique_ptr< BOARD_EXPECTATION > createFootprintExpectation ( const nlohmann::json & aExpectationEntry)
static

◆ createGraphicExpectation()

static std::unique_ptr< BOARD_EXPECTATION > createGraphicExpectation ( const nlohmann::json & aExpectationEntry)
static

◆ createLayerExpectation()

static std::unique_ptr< BOARD_EXPECTATION > createLayerExpectation ( const nlohmann::json & aExpectationEntry)
static

◆ createNetExpectation()

static std::unique_ptr< BOARD_EXPECTATION > createNetExpectation ( const nlohmann::json & aExpectationEntry)
static

◆ getStringArray()

static std::vector< std::string > getStringArray ( const nlohmann::json & aJson)
static

Definition at line 425 of file board_expectations.cpp.

References result.

Referenced by createLayerExpectation(), and createNetExpectation().

◆ parsePcbDim() [1/2]

static int parsePcbDim ( const nlohmann::json & aJson)
static

Parse a dimension from JSON, which can be either an integer (in mm) or a string with units (e.g.

"25 mil")

Parameters
aJsonThe JSON value to parse
Returns
The parsed dimension in internal units (IU)

Definition at line 506 of file board_expectations.cpp.

References EDA_UNIT_UTILS::UI::DoubleValueFromString(), KiROUND(), MM, and pcbIUScale.

Referenced by createCircleExpectation(), parsePcbDim(), and parsePosition().

◆ parsePcbDim() [2/2]

static int parsePcbDim ( const nlohmann::json & aJson,
const std::string & aFieldName )
static

Definition at line 523 of file board_expectations.cpp.

References parsePcbDim().

◆ parsePosition()

static VECTOR2I parsePosition ( const nlohmann::json & aJson,
const std::string & aFieldName )
static

Definition at line 534 of file board_expectations.cpp.

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

Referenced by createCircleExpectation().