KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_libeval_compiler.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <boost/test/data/test_case.hpp>
#include <wx/wx.h>
#include <layer_ids.h>
#include <pcbnew/pcbexpr_evaluator.h>
#include <drc/drc_rule.h>
#include <pcbnew/board.h>
#include <board_design_settings.h>
#include <pcbnew/pcb_track.h>
#include <pcbnew/footprint.h>
#include <pcbnew/pcb_text.h>
#include <project/net_settings.h>
#include <properties/property.h>
#include <properties/property_mgr.h>

Go to the source code of this file.

Classes

struct  EXPR_TO_TEST
 

Typedefs

using VAL = LIBEVAL::VALUE
 

Functions

static bool testEvalExpr (const wxString &expr, const LIBEVAL::VALUE &expectedResult, bool expectError=false, BOARD_ITEM *itemA=nullptr, BOARD_ITEM *itemB=nullptr)
 
 BOOST_AUTO_TEST_CASE (IntrospectedProperties)
 
 BOOST_AUTO_TEST_CASE (InNetChainClassWildcard)
 
 BOOST_AUTO_TEST_CASE (ParentNavigation)
 

Variables

static const std::vector< EXPR_TO_TESTsimpleExpressions
 
static const std::vector< EXPR_TO_TESTintrospectionExpressions
 

Typedef Documentation

◆ VAL

Definition at line 52 of file test_libeval_compiler.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

◆ BOOST_AUTO_TEST_CASE() [2/3]

◆ BOOST_AUTO_TEST_CASE() [3/3]

◆ testEvalExpr()

Variable Documentation

◆ introspectionExpressions

const std::vector<EXPR_TO_TEST> introspectionExpressions
static
Initial value:
= {
{ "A.type == 'Pad' && B.type == 'Pad' && (A.existsOnLayer('F.Cu'))", false, VAL( 0.0 ) },
{ "A.Width > B.Width", false, VAL( 0.0 ) },
{ "A.Width + B.Width", false, VAL( pcbIUScale.MilsToIU(10) + pcbIUScale.MilsToIU(20) ) },
{ "A.Netclass", false, VAL( "HV_LINE" ) },
{ "(A.Netclass == 'HV_LINE') && (B.netclass == 'otherClass') && (B.netclass != 'F.Cu')", false,
VAL( 1.0 ) },
{ "A.Netclass + 1.0", false, VAL( 1.0 ) },
{ "A.hasNetclass('HV_LINE')", false, VAL( 1.0 ) },
{ "A.hasNetclass('HV_*')", false, VAL( 1.0 ) },
{ "A.type == 'Track' && B.type == 'Track' && A.layer == 'F.Cu'", false, VAL( 1.0 ) },
{ "(A.type == 'Track') && (B.type == 'Track') && (A.layer == 'F.Cu')", false, VAL( 1.0 ) },
{ "A.type == 'Via' && A.isMicroVia()", false, VAL(0.0) }
}
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:121
constexpr int MilsToIU(int mils) const
Definition base_units.h:95
LIBEVAL::VALUE VAL

Definition at line 88 of file test_libeval_compiler.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ simpleExpressions

const std::vector<EXPR_TO_TEST> simpleExpressions
static

Definition at line 54 of file test_libeval_compiler.cpp.