20#include <boost/test/unit_test.hpp>
41static const char*
DUAL_ZONE_PCB =
"net_chains/return_path_dual_zone.kicad_pcb";
46size_t runDrc(
const std::string& aDru,
const std::string& aSubdir )
48 namespace fs = std::filesystem;
49 fs::path tmpDir = fs::temp_directory_path() / aSubdir;
50 fs::create_directories( tmpDir );
51 fs::path druPath = tmpDir /
"rn.kicad_dru";
54 std::ofstream out( druPath );
60 board->BuildConnectivity();
62 NETINFO_ITEM* sig = board->FindNet( wxS(
"/CHAIN_RN" ) );
67 auto drcEngine = std::make_shared<DRC_ENGINE>( board.get(), &bds );
68 wxFileName ruleFile( druPath.string() );
69 drcEngine->InitEngine( ruleFile );
80 size_t markerCount = 0;
81 drcEngine->SetViolationHandler(
82 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
91 fs::remove( druPath );
103 const std::string dru =
106 (condition "A.NetClass == 'Default'")
107 (constraint length (min 0mm) (max 200mm))
108 (constraint return_path (layer "B.Cu"))
118 const std::string dru =
121 (condition "A.NetClass == 'Default'")
122 (constraint length (min 0mm) (max 200mm))
123 (constraint return_path (layer "B.Cu") (net "GND"))
130 size_t n = runDrc( dru,
"kicad_drc_rn_gnd_match" );
131 BOOST_CHECK_LE( n, 1u );
138 const std::string dru =
141 (condition "A.NetClass == 'Default'")
142 (constraint length (min 0mm) (max 200mm))
143 (constraint return_path (layer "B.Cu") (net "PWR_*"))
146 size_t n = runDrc( dru,
"kicad_drc_rn_wildcard_nomatch" );
147 BOOST_CHECK_GE( n, 1u );
154 const std::string dru =
157 (condition "A.NetClass == 'Default'")
158 (constraint length (min 0mm) (max 200mm))
159 (constraint return_path (layer "B.Cu") (net "GND*"))
162 size_t n = runDrc( dru,
"kicad_drc_rn_wildcard_match" );
163 BOOST_CHECK_LE( n, 1u );
General utilities for PCB file IO for QA programs.
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.
std::unique_ptr< BOARD > LoadBoard(const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr)
Load information from some input file format that this PCB_IO implementation knows about into new BOA...
@ DRCE_LIB_FOOTPRINT_ISSUES
@ DRCE_DRILL_OUT_OF_RANGE
@ DRCE_NET_CHAIN_RETURN_PATH_BREAK
@ DRCE_LIB_FOOTPRINT_MISMATCH
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
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