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 );
59 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
61 board->BuildConnectivity();
63 NETINFO_ITEM* sig = board->FindNet( wxS(
"/CHAIN_RN" ) );
68 auto drcEngine = std::make_shared<DRC_ENGINE>( board.get(), &bds );
69 wxFileName ruleFile( druPath.string() );
70 drcEngine->InitEngine( ruleFile );
81 size_t markerCount = 0;
82 drcEngine->SetViolationHandler(
83 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
92 fs::remove( druPath );
104 const std::string dru =
107 (condition "A.NetClass == 'Default'")
108 (constraint length (min 0mm) (max 200mm))
109 (constraint return_path (layer "B.Cu"))
119 const std::string dru =
122 (condition "A.NetClass == 'Default'")
123 (constraint length (min 0mm) (max 200mm))
124 (constraint return_path (layer "B.Cu") (net "GND"))
131 size_t n = runDrc( dru,
"kicad_drc_rn_gnd_match" );
132 BOOST_CHECK_LE( n, 1u );
139 const std::string dru =
142 (condition "A.NetClass == 'Default'")
143 (constraint length (min 0mm) (max 200mm))
144 (constraint return_path (layer "B.Cu") (net "PWR_*"))
147 size_t n = runDrc( dru,
"kicad_drc_rn_wildcard_nomatch" );
148 BOOST_CHECK_GE( n, 1u );
155 const std::string dru =
158 (condition "A.NetClass == 'Default'")
159 (constraint length (min 0mm) (max 200mm))
160 (constraint return_path (layer "B.Cu") (net "GND*"))
163 size_t n = runDrc( dru,
"kicad_drc_rn_wildcard_match" );
164 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.
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
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