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 <sstream>
#include <core/profile.h>
#include <board.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <pad.h>
#include <pcbexpr_evaluator.h>
#include <pcb_field.h>
#include <pcb_group.h>
#include <pcb_shape.h>
#include <pcb_track.h>
#include <project/net_settings.h>
#include <zone.h>

Go to the source code of this file.

Classes

class  SCALAR_CONSTRAINT
 A constraint on a scalar value (counts, dimensions, etc.), supporting exact, min, and max bounds. More...
 
struct  SCALAR_CONSTRAINT::PARSED_SCALAR
 
class  STRING_PATTERN_MATCHER
 Glob-like pattern matcher for strings, supporting '*' and '? More...
 
class  NET_EXPECTATION
 
class  NETCLASS_EXPECTATION
 
class  LAYER_EXPECTATION
 
class  ITEM_EVAL_EXPECTATION
 

Functions

static std::string vecToString (std::span< const std::string > aVec)
 Format a vector of strings for display, e.g.
 
static void CheckConstraint (const SCALAR_CONSTRAINT &aConstraint, int aActual)
 Assert that aActual satisfies aConstraint using Boost.Test macros.
 
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_EXPECTATIONcreateNetClassExpectation (const nlohmann::json &aExpectationEntry)
 
static std::unique_ptr< BOARD_EXPECTATIONcreateLayerExpectation (const nlohmann::json &aExpectationEntry)
 
static std::unique_ptr< BOARD_EXPECTATIONcreateItemExprExpectation (const nlohmann::json &aExpectationEntry)
 

Function Documentation

◆ CheckConstraint()

static void CheckConstraint ( const SCALAR_CONSTRAINT & aConstraint,
int aActual )
static

Assert that aActual satisfies aConstraint using Boost.Test macros.

Each bound is checked individually so that failures report the specific bound that was violated, with values formatted in the constraint's original units.

Definition at line 287 of file board_expectations.cpp.

References BOOST_TEST(), expected, SCALAR_CONSTRAINT::Format(), SCALAR_CONSTRAINT::GetMax(), SCALAR_CONSTRAINT::GetMin(), and SCALAR_CONSTRAINT::IsExact().

Referenced by NET_EXPECTATION::doSimpleCountTest(), NETCLASS_EXPECTATION::doSimpleCountTest(), ITEM_EVAL_EXPECTATION::RunTest(), LAYER_EXPECTATION::RunTest(), NET_EXPECTATION::RunTest(), and NETCLASS_EXPECTATION::RunTest().

◆ createItemExprExpectation()

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

◆ createLayerExpectation()

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

◆ createNetClassExpectation()

static std::unique_ptr< BOARD_EXPECTATION > createNetClassExpectation ( 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

◆ vecToString()

static std::string vecToString ( std::span< const std::string > aVec)
static

Format a vector of strings for display, e.g.

["GND", "VCC"]

Definition at line 52 of file board_expectations.cpp.

Referenced by NET_EXPECTATION::GetName(), and NETCLASS_EXPECTATION::GetName().