49 std::vector<wxString> tests = {
63 "issue17967/issue17967",
66 "unconnected-netnames/unconnected-netnames",
69 "diff_pair_uncoupled_tuning_drc"
72 for(
const wxString& relPath : tests )
77 std::vector<DRC_ITEM> violations;
91 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
92 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
95 violations.push_back( *aItem );
100 if( violations.empty() )
110 std::map<KIID, EDA_ITEM*> itemMap;
111 m_board->FillItemMap( itemMap );
113 for(
const DRC_ITEM& item : violations )
116 BOOST_ERROR( wxString::Format(
"DRC regression: %s\n"
117 "%d violations found (expected 0)\n"
120 (
int) violations.size(),
131 std::map<int, SEVERITY> issue19325_ignore, issue22102_ignore;
138 {
"issue1358", 2, {} },
139 {
"issue2512", 5, {} },
140 {
"issue2528", 1, {} },
141 {
"issue5750", 4, {} },
142 {
"issue5854", 3, {} },
143 {
"issue6879", 6, {} },
144 {
"issue6945", 2, {} },
145 {
"issue7241", 1, {} },
146 {
"issue7267", 5, {} },
147 {
"issue7325", 2, {} },
148 {
"issue8003", 2, {} },
149 {
"issue9081", 2, {} },
150 {
"issue12109", 8, {} },
151 {
"issue14334", 2, {} },
152 {
"issue16566", 6, {} },
153 {
"issue18142", 1, {} },
154 {
"reverse_via", 3, {} },
155 {
"intersectingzones", 1, {} },
156 {
"fill_bad", 1, {} },
157 {
"issue18878", 12, {} },
158 {
"issue19325/issue19325", 4, issue19325_ignore },
159 {
"issue22102", 2, issue22102_ignore },
160 {
"issue11814", 2, {} },
163 for(
const auto& [testName, expectedErrors, customSeverities] : tests )
168 std::vector<PCB_MARKER> markers;
169 std::vector<DRC_ITEM> violations;
178 for(
const auto [
test, severity] : customSeverities)
182 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
183 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
185 markers.emplace_back(
PCB_MARKER( aItem, aPos ) );
190 violations.push_back( *aItem );
196 if( violations.size() == expectedErrors )
206 std::map<KIID, EDA_ITEM*> itemMap;
207 m_board->FillItemMap( itemMap );
209 for(
const DRC_ITEM& item : violations )
212 BOOST_ERROR( wxString::Format(
"DRC regression: %s\n"
213 "%d violations found (expected %d)\n"
216 (
int) violations.size(),
229 std::vector<wxString> tests =
231 "issue19090/issue19090",
232 "issue23467/issue23467",
235 for(
const wxString& relPath : tests )
240 std::vector<DRC_ITEM> violations;
254 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
255 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
258 violations.push_back( *aItem );
263 if( violations.empty() )
273 std::map<KIID, EDA_ITEM*> itemMap;
274 m_board->FillItemMap( itemMap );
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 );
322 std::map<KIID, EDA_ITEM*> itemMap;
323 m_board->FillItemMap( itemMap );
325 auto involvesCopperField =
328 for(
const KIID&
id : { aItem.GetMainItemID(), aItem.GetAuxItemID() } )
330 auto it = itemMap.find(
id );
332 if( it != itemMap.end() && it->second->Type() ==
PCB_FIELD_T )
341 for(
const DRC_ITEM& item : violations )
347 if( fieldShorts != 1 )
351 for(
const DRC_ITEM& item : violations )
356 BOOST_CHECK_MESSAGE( fieldShorts == 1,
357 "Expected exactly one shorting-items violation involving a visible "
358 "knockout copper reference field; found "
372 std::vector<DRC_ITEM> violations;
380 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
384 violations.push_back( *aItem );
389 BOOST_REQUIRE_MESSAGE( !violations.empty(),
"Expected at least one hole-to-hole violation" );
399 for(
const DRC_ITEM& item : violations )
401 wxString msg = item.GetErrorMessage(
false );
403 BOOST_CHECK_MESSAGE( msg.Contains( ruleValue ),
404 wxString::Format(
"Expected the configured minimum '%s' but got: %s",
407 BOOST_CHECK_MESSAGE( !msg.Contains( relaxedValue ),
408 wxString::Format(
"Reported the epsilon-relaxed minimum '%s': %s",
409 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
std::set< wxString > m_DrcExclusions
int GetDRCEpsilon() const
Return an epsilon which accounts for rounding errors, etc.
SEVERITY GetSeverity(int aDRCErrorCode)
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).
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_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)
SETTINGS_MANAGER m_settingsManager
DRC_REGRESSION_TEST_FIXTURE()
std::unique_ptr< 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