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",
71 "net_tie_hole_clearance",
73 "diff_pair_uncoupled_tuning_drc"
76 for(
const wxString& relPath : tests )
81 std::vector<DRC_ITEM> violations;
95 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
96 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
99 violations.push_back( *aItem );
104 if( violations.empty() )
116 for(
const DRC_ITEM& item : violations )
119 BOOST_ERROR( wxString::Format(
"DRC regression: %s\n"
120 "%d violations found (expected 0)\n"
123 (
int) violations.size(),
134 std::map<int, SEVERITY> issue19325_ignore, issue22102_ignore, issue18142_ignore;
142 {
"issue1358", 2, {} },
143 {
"issue2512", 5, {} },
144 {
"issue2528", 1, {} },
145 {
"issue5750", 4, {} },
146 {
"issue5854", 3, {} },
147 {
"issue6879", 6, {} },
148 {
"issue6945", 2, {} },
149 {
"issue7241", 1, {} },
150 {
"issue7267", 6, {} },
151 {
"issue7325", 2, {} },
152 {
"issue8003", 2, {} },
153 {
"issue9081", 2, {} },
154 {
"issue12109", 8, {} },
155 {
"issue14334", 2, {} },
156 {
"issue16566", 6, {} },
157 {
"issue18142", 1, issue18142_ignore },
158 {
"reverse_via", 3, {} },
159 {
"intersectingzones", 1, {} },
160 {
"fill_bad", 1, {} },
161 {
"issue18878", 12, {} },
162 {
"issue19325/issue19325", 4, issue19325_ignore },
163 {
"issue22102", 2, issue22102_ignore },
164 {
"issue11814", 2, {} },
167 for(
const auto& [testName, expectedErrors, customSeverities] : tests )
172 std::vector<PCB_MARKER> markers;
173 std::vector<DRC_ITEM> violations;
182 for(
const auto [
test, severity] : customSeverities)
186 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
187 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
189 markers.emplace_back(
PCB_MARKER( aItem, aPos ) );
194 violations.push_back( *aItem );
200 if( violations.size() == expectedErrors )
212 for(
const DRC_ITEM& item : violations )
215 BOOST_ERROR( wxString::Format(
"DRC regression: %s\n"
216 "%d violations found (expected %d)\n"
219 (
int) violations.size(),
232 std::vector<wxString> tests =
234 "issue19090/issue19090",
235 "issue23467/issue23467",
238 for(
const wxString& relPath : tests )
243 std::vector<DRC_ITEM> violations;
257 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
258 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
261 violations.push_back( *aItem );
266 if( violations.empty() )
278 for(
const DRC_ITEM& item : violations )
281 BOOST_ERROR( wxString::Format(
"DRC zone regression: %s\n"
282 "%d violations found (expected 0)\n"
285 (
int) violations.size(),
304 std::vector<DRC_ITEM> violations;
316 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
319 violations.push_back( *aItem );
326 auto involvesCopperField =
329 for(
const KIID&
id : { aItem.GetMainItemID(), aItem.GetAuxItemID() } )
342 for(
const DRC_ITEM& item : violations )
348 if( fieldShorts != 1 )
352 for(
const DRC_ITEM& item : violations )
357 BOOST_CHECK_MESSAGE( fieldShorts == 1,
358 "Expected exactly one shorting-items violation involving a visible "
359 "knockout copper reference field; found "
373 std::vector<DRC_ITEM> violations;
381 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
385 violations.push_back( *aItem );
400 for(
const DRC_ITEM& item : violations )
402 wxString msg = item.GetErrorMessage(
false );
404 BOOST_CHECK_MESSAGE( msg.Contains( ruleValue ),
405 wxString::Format(
"Expected the configured minimum '%s' but got: %s",
408 BOOST_CHECK_MESSAGE( !msg.Contains( relaxedValue ),
409 wxString::Format(
"Reported the epsilon-relaxed minimum '%s': %s",
410 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
@ DRCE_MICROVIA_SPANS_DIELECTRICS
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
void FillZones(BOARD *m_board)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE_MESSAGE(dc.CacheTableInfo(table, { "part_id", "val" }), dc.GetLastError())
BOOST_REQUIRE(res.columns()==1)
BOOST_FIXTURE_TEST_CASE(DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTURE)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
VECTOR2< int32_t > VECTOR2I