37struct DRC_REGRESSION_TEST_FIXTURE
39 DRC_REGRESSION_TEST_FIXTURE()
42 SETTINGS_MANAGER m_settingsManager;
43 std::unique_ptr<BOARD> m_board;
52 std::vector<wxString> tests = {
66 "issue17967/issue17967",
69 "unconnected-netnames/unconnected-netnames",
72 "diff_pair_uncoupled_tuning_drc"
75 for(
const wxString& relPath : tests )
80 std::vector<DRC_ITEM> violations;
94 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
95 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
98 violations.push_back( *aItem );
103 if( violations.empty() )
115 for(
const DRC_ITEM& item : violations )
118 BOOST_ERROR( wxString::Format(
"DRC regression: %s\n"
119 "%d violations found (expected 0)\n"
122 (
int) violations.size(),
133 std::map<int, SEVERITY> issue19325_ignore, issue22102_ignore, issue18142_ignore;
140 {
"issue1358", 2, {} },
141 {
"issue2512", 5, {} },
142 {
"issue2528", 1, {} },
143 {
"issue5750", 4, {} },
144 {
"issue5854", 3, {} },
145 {
"issue6879", 6, {} },
146 {
"issue6945", 2, {} },
147 {
"issue7241", 1, {} },
148 {
"issue7267", 6, {} },
149 {
"issue7325", 2, {} },
150 {
"issue8003", 2, {} },
151 {
"issue9081", 2, {} },
152 {
"issue12109", 8, {} },
153 {
"issue14334", 2, {} },
154 {
"issue16566", 6, {} },
155 {
"issue18142", 1, issue18142_ignore },
156 {
"reverse_via", 3, {} },
157 {
"intersectingzones", 1, {} },
158 {
"fill_bad", 1, {} },
159 {
"issue18878", 12, {} },
160 {
"issue19325/issue19325", 4, issue19325_ignore },
161 {
"issue22102", 2, issue22102_ignore },
162 {
"issue11814", 2, {} },
165 for(
const auto& [testName, expectedErrors, customSeverities] : tests )
170 std::vector<PCB_MARKER> markers;
171 std::vector<DRC_ITEM> violations;
180 for(
const auto [
test, severity] : customSeverities)
184 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
185 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
187 markers.emplace_back(
PCB_MARKER( aItem, aPos ) );
192 violations.push_back( *aItem );
198 if( violations.size() == expectedErrors )
210 for(
const DRC_ITEM& item : violations )
213 BOOST_ERROR( wxString::Format(
"DRC regression: %s\n"
214 "%d violations found (expected %d)\n"
217 (
int) violations.size(),
230 std::vector<wxString> tests =
232 "issue19090/issue19090",
233 "issue23467/issue23467",
236 for(
const wxString& relPath : tests )
241 std::vector<DRC_ITEM> violations;
255 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
256 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
259 violations.push_back( *aItem );
264 if( violations.empty() )
276 for(
const DRC_ITEM& item : violations )
279 BOOST_ERROR( wxString::Format(
"DRC zone regression: %s\n"
280 "%d violations found (expected 0)\n"
283 (
int) violations.size(),
302 std::vector<DRC_ITEM> violations;
314 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
317 violations.push_back( *aItem );
324 auto involvesCopperField =
327 for(
const KIID&
id : { aItem.GetMainItemID(), aItem.GetAuxItemID() } )
340 for(
const DRC_ITEM& item : violations )
346 if( fieldShorts != 1 )
350 for(
const DRC_ITEM& item : violations )
355 BOOST_CHECK_MESSAGE( fieldShorts == 1,
356 "Expected exactly one shorting-items violation involving a visible "
357 "knockout copper reference field; found "
371 std::vector<DRC_ITEM> violations;
379 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
383 violations.push_back( *aItem );
388 BOOST_REQUIRE_MESSAGE( !violations.empty(),
"Expected at least one hole-to-hole violation" );
398 for(
const DRC_ITEM& item : violations )
400 wxString msg = item.GetErrorMessage(
false );
402 BOOST_CHECK_MESSAGE( msg.Contains( ruleValue ),
403 wxString::Format(
"Expected the configured minimum '%s' but got: %s",
406 BOOST_CHECK_MESSAGE( !msg.Contains( relaxedValue ),
407 wxString::Format(
"Reported the epsilon-relaxed minimum '%s': %s",
408 relaxedValue, msg ) );
constexpr EDA_IU_SCALE pcbIUScale
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
std::shared_ptr< DRC_ENGINE > m_DRCEngine
SEVERITY GetSeverity(int aDRCErrorCode) const
Return the severity of a given DRC error code.
int GetDRCEpsilon() const
Return an epsilon which accounts for rounding errors, etc.
std::set< DRC_EXCLUSION, DRC_EXCLUSION_COMPARE > m_DrcExclusions
Implements the RC_ITEM_RESOLVER interface to resolve PCB items by their KIID.
void RunTests(EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints, BOARD_COMMIT *aCommit=nullptr)
Run the DRC tests.
void SetViolationHandler(DRC_VIOLATION_HANDLER aHandler)
Set an optional DRC violation handler (receives DRC_ITEMs and positions).
static DRC_EXCLUSION FromMarker(const PCB_MARKER &aMarker)
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * ResolveItemById(const KIID &aKiid) const
Resolve an item by its KIID.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
@ DRCE_LIB_FOOTPRINT_ISSUES
@ DRCE_MICROVIA_CROSSES_CORE
@ DRCE_TRACK_NOT_CENTERED_ON_VIA
@ DRCE_DRILLED_HOLES_TOO_CLOSE
@ DRCE_LIB_FOOTPRINT_MISMATCH
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
void FillZones(BOARD *m_board)
BOOST_FIXTURE_TEST_CASE(DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTURE)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
VECTOR2< int32_t > VECTOR2I