21#include <boost/test/unit_test.hpp>
44 (generator_version "9.99")
54 (gr_line (start -5 -5) (end 35 -5) (layer "Edge.Cuts") (width 0.05))
55 (gr_line (start 35 -5) (end 35 5) (layer "Edge.Cuts") (width 0.05))
56 (gr_line (start 35 5) (end -5 5) (layer "Edge.Cuts") (width 0.05))
57 (gr_line (start -5 5) (end -5 -5) (layer "Edge.Cuts") (width 0.05))
58 (segment (start 0 0) (end 30 0) (width 0.2) (layer "F.Cu") (net 1))
59 (zone (net 2) (net_name "/GND") (layer "B.Cu") (name "gnd_full") (hatch edge 0.508)
60 (connect_pads (clearance 0))
61 (min_thickness 0.254) (filled_areas_thickness no)
62 (fill (thermal_gap 0.508) (thermal_bridge_width 0.508))
64 (pts (xy -1 -1) (xy 31 -1) (xy 31 1) (xy -1 1))
67 (zone (net 3) (net_name "/VCC") (layer "B.Cu") (name "vcc_strip") (hatch edge 0.508)
68 (connect_pads (clearance 0))
69 (min_thickness 0.254) (filled_areas_thickness no)
70 (fill (thermal_gap 0.508) (thermal_bridge_width 0.508))
72 (pts (xy -1 1.5) (xy 31 1.5) (xy 31 2) (xy -1 2))
81size_t runDrc(
const std::string& aDru,
const std::string& aSubdir )
83 namespace fs = std::filesystem;
84 fs::path tmpDir = fs::temp_directory_path() / aSubdir;
85 fs::create_directories( tmpDir );
86 fs::path pcbPath = tmpDir /
"rn.kicad_pcb";
87 fs::path druPath = tmpDir /
"rn.kicad_dru";
90 std::ofstream out( pcbPath );
95 std::ofstream out( druPath );
100 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
101 plugin.
LoadBoard( pcbPath.string(), board.get() );
102 board->BuildConnectivity();
104 NETINFO_ITEM* sig = board->FindNet( wxS(
"/CHAIN_RN" ) );
109 auto drcEngine = std::make_shared<DRC_ENGINE>( board.get(), &bds );
110 wxFileName ruleFile( druPath.string() );
111 drcEngine->InitEngine( ruleFile );
122 size_t markerCount = 0;
123 drcEngine->SetViolationHandler(
124 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
133 fs::remove( pcbPath );
134 fs::remove( druPath );
146 const std::string dru =
149 (condition "A.NetClass == 'Default'")
150 (constraint length (min 0mm) (max 200mm))
151 (constraint return_path (layer "B.Cu"))
161 const std::string dru =
164 (condition "A.NetClass == 'Default'")
165 (constraint length (min 0mm) (max 200mm))
166 (constraint return_path (layer "B.Cu") (net "GND"))
173 size_t n = runDrc( dru,
"kicad_drc_rn_gnd_match" );
174 BOOST_CHECK_LE( n, 1u );
181 const std::string dru =
184 (condition "A.NetClass == 'Default'")
185 (constraint length (min 0mm) (max 200mm))
186 (constraint return_path (layer "B.Cu") (net "PWR_*"))
189 size_t n = runDrc( dru,
"kicad_drc_rn_wildcard_nomatch" );
190 BOOST_CHECK_GE( n, 1u );
197 const std::string dru =
200 (condition "A.NetClass == 'Default'")
201 (constraint length (min 0mm) (max 200mm))
202 (constraint return_path (layer "B.Cu") (net "GND*"))
205 size_t n = runDrc( dru,
"kicad_drc_rn_wildcard_match" );
206 BOOST_CHECK_LE( n, 1u );
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
std::shared_ptr< DRC_ENGINE > m_DRCEngine
Handle the data for a net.
void SetNetChain(const wxString &aNetChain)
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
@ DRCE_LIB_FOOTPRINT_ISSUES
@ DRCE_DRILL_OUT_OF_RANGE
@ DRCE_NET_CHAIN_RETURN_PATH_BREAK
@ DRCE_LIB_FOOTPRINT_MISMATCH
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
static const char * DUAL_ZONE_PCB
BOOST_AUTO_TEST_CASE(ReferenceNetEmptyAcceptsAnyZoneRegression)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I