12 #include <unordered_set> 26 bool error = !compiler.
Compile( expr, &ucode, &preflightContext );
46 result = *ucode.
Run( &context );
47 ok = (result.
EqualTo( &expectedResult) );
54 int main(
int argc,
char *argv[] )
75 NETCLASSPTR netclass1(
new NETCLASS(
"HV") );
76 NETCLASSPTR netclass2(
new NETCLASS(
"otherClass" ) );
81 net1info->SetClass( netclass1 );
82 net2info->SetClass( netclass2 );
95 testEvalExpr(
"A.fromTo('U1', 'U3') && A.NetClass == 'DDR3_A' ",
VAL(0),
false, &trackA, &trackB );
100 testEvalExpr(
"A.type == 'Pad' && B.type == 'Pad' && (A.existsOnLayer('F.Cu'))",
VAL( 0.0 ),
false, &trackA, &trackB );
102 testEvalExpr(
"A.Width > B.Width",
VAL( 0.0 ),
false, &trackA, &trackB );
103 testEvalExpr(
"A.Width + B.Width",
VAL( Mils2iu(10) + Mils2iu(20) ),
false, &trackA, &trackB );
106 testEvalExpr(
"(A.Netclass == 'HV') && (B.netclass == 'otherClass') && (B.netclass != 'F.Cu')",
VAL( 1.0 ),
false, &trackA, &trackB );
107 testEvalExpr(
"A.Netclass + 1.0",
VAL( 1.0 ),
false, &trackA, &trackB );
108 testEvalExpr(
"A.type == 'Track' && B.type == 'Track' && A.layer == 'F.Cu'",
VAL( 0.0 ),
false, &trackA, &trackB );
109 testEvalExpr(
"(A.type == 'Track') && (B.type == 'Track') && (A.layer == 'F.Cu')",
VAL( 0.0 ),
false, &trackA, &trackB );
void Rebuild()
Rebuild the list of all registered properties.
void SetItems(BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
static PROPERTY_MANAGER & Instance()
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
const NETINFO_LIST & GetNetInfo() const
virtual wxString GetNetClassName() const
Returns the netclass of the zone.
bool Compile(const wxString &aString, UCODE *aCode, CONTEXT *aPreflightContext)
void SetWidth(int aWidth)
virtual bool EqualTo(const VALUE *b) const
Container for NETINFO_ITEM elements, which are the nets.
A collection of nets and the parameters used to route or test these nets.
bool testEvalExpr(const std::string expr, LIBEVAL::VALUE expectedResult, bool expectError=false, BOARD_ITEM *itemA=nullptr, BOARD_ITEM *itemB=nullptr)
Handle the data for a net.
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
Information pertinent to a Pcbnew printed circuit board.
Provide class metadata.Helper macro to map type hashes to names.
VALUE * Run(CONTEXT *ctx)
int main(int argc, char *argv[])