#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 <pcbnew/pcb_track.h>
 
Go to the source code of this file.
◆ VAL
◆ BOOST_AUTO_TEST_CASE()
      
        
          | BOOST_AUTO_TEST_CASE  | 
          ( | 
          IntrospectedProperties |            | ) | 
           | 
        
      
 
 
◆ testEvalExpr()
  
  
      
        
          | static bool testEvalExpr  | 
          ( | 
          const wxString & |           expr,  | 
         
        
           | 
           | 
          const LIBEVAL::VALUE & |           expectedResult,  | 
         
        
           | 
           | 
          bool |           expectError = false,  | 
         
        
           | 
           | 
          BOARD_ITEM * |           itemA = nullptr,  | 
         
        
           | 
           | 
          BOARD_ITEM * |           itemB = nullptr ) | 
         
       
   | 
  
static   | 
  
 
Definition at line 98 of file test_libeval_compiler.cpp.
References LIBEVAL::VALUE::AsDouble(), LIBEVAL::VALUE::AsString(), BOOST_CHECK_EQUAL(), BOOST_TEST_MESSAGE(), LIBEVAL::COMPILER::Compile(), LIBEVAL::COMPILER::GetError(), LIBEVAL::VALUE::GetType(), LIBEVAL::ERROR_STATUS::message, NULL_CONSTRAINT, result, LIBEVAL::UCODE::Run(), PCBEXPR_CONTEXT::SetItems(), LIBEVAL::ERROR_STATUS::srcPos, UNDEFINED_LAYER, and LIBEVAL::VT_NUMERIC.
Referenced by BOOST_AUTO_TEST_CASE().
 
 
◆ introspectionExpressions
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.Netclass", 
false, 
VAL( 
"HV_LINE" ) },
 
    { "(A.Netclass == 'HV_LINE') && (B.netclass == 'otherClass') && (B.netclass != 'F.Cu')", false,
    { 
"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
 
constexpr int MilsToIU(int mils) const
 
 
Definition at line 82 of file test_libeval_compiler.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
 
 
◆ simpleExpressions
Initial value:= {
    { 
"10mm + 20 mm", 
false, 
VAL( 30e6 ) },
 
    { 
"3*(7+8)", 
false, 
VAL( 3 * ( 7 + 8 ) ) },
 
    { 
"3*7+8", 
false, 
VAL( 3 * 7 + 8 ) },
 
    { 
"(3*7)+8", 
false, 
VAL( 3 * 7 + 8 ) },
 
    { 
"10mm + 20)", 
true, 
VAL( 0 ) },
 
 
    { 
"1.5", 
false, 
VAL(1.5) },
 
    { 
"1,5", 
false, 
VAL(1.5) },
 
    { 
"1mm", 
false, 
VAL(1e6) },
 
    
    { 
"   1 +     2    ", 
false, 
VAL(3) },
 
    
    { 
"1.5 + 0.2 + 0.1", 
false, 
VAL(1.8) },
 
    
    { 
"3 - 10", 
false, 
VAL(-7) },
 
    
    { 
"1 + 2 + 10 + 1000.05", 
false, 
VAL(1013.05) },
 
    
    { 
"1 + 2 - 4 * 20 / 2", 
false, 
VAL(-37) },
 
    
    { 
"(1)", 
false, 
VAL(1) },
 
    
    { 
"-(1 + (2 - 4)) * 20.8 / 2", 
false, 
VAL(10.4) },
 
    
    { 
"+2 - 1", 
false, 
VAL(1) }
 
}
 
Definition at line 52 of file test_libeval_compiler.cpp.