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 <gal/color4d.h>
#include <geometry/eda_angle.h>
#include <pcbnew/pcbexpr_evaluator.h>
#include <drc/drc_rule.h>
#include <pcbnew/board.h>
#include <board_design_settings.h>
#include <pcbnew/pcb_shape.h>
#include <pcbnew/pcb_table.h>
#include <pcbnew/pcb_track.h>
#include <pcbnew/footprint.h>
#include <pcbnew/pcb_text.h>
#include <pcbnew/zone.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)
 
static void expectCompileError (const wxString &aExpr)
 
static void expectCompileSuccess (const wxString &aExpr)
 
 BOOST_AUTO_TEST_CASE (IntrospectedProperties)
 
 BOOST_AUTO_TEST_CASE (IntrospectedExtendedNumericProperties)
 
 BOOST_AUTO_TEST_CASE (IntrospectedColorProperties)
 
 BOOST_AUTO_TEST_CASE (ExpressionPropertyTypesAreSupported)
 
 BOOST_AUTO_TEST_CASE (IntrospectedPropertyAvailability)
 
 BOOST_AUTO_TEST_CASE (InNetChainClassWildcard)
 
 BOOST_AUTO_TEST_CASE (ParentNavigation)
 
 BOOST_AUTO_TEST_CASE (ReceiverValidation)
 
 BOOST_AUTO_TEST_CASE (PairItemDependency)
 

Variables

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

Typedef Documentation

◆ VAL

Definition at line 57 of file test_libeval_compiler.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/9]

◆ BOOST_AUTO_TEST_CASE() [2/9]

◆ BOOST_AUTO_TEST_CASE() [3/9]

BOOST_AUTO_TEST_CASE ( IntrospectedColorProperties )

◆ BOOST_AUTO_TEST_CASE() [4/9]

◆ BOOST_AUTO_TEST_CASE() [5/9]

◆ BOOST_AUTO_TEST_CASE() [6/9]

BOOST_AUTO_TEST_CASE ( IntrospectedPropertyAvailability )

◆ BOOST_AUTO_TEST_CASE() [7/9]

BOOST_AUTO_TEST_CASE ( PairItemDependency )

◆ BOOST_AUTO_TEST_CASE() [8/9]

◆ BOOST_AUTO_TEST_CASE() [9/9]

BOOST_AUTO_TEST_CASE ( ReceiverValidation )

Definition at line 438 of file test_libeval_compiler.cpp.

References expectCompileError(), and expectCompileSuccess().

◆ expectCompileError()

static void expectCompileError ( const wxString & aExpr)
static

◆ expectCompileSuccess()

static void expectCompileSuccess ( const wxString & aExpr)
static

◆ 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.Net_Class == 'HV_LINE'", false, VAL( 1.0 ) },
{ "(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 93 of file test_libeval_compiler.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ simpleExpressions

const std::vector<EXPR_TO_TEST> simpleExpressions
static

Definition at line 59 of file test_libeval_compiler.cpp.