22#include <boost/test/data/test_case.hpp>
51 m_board->GetDesignSettings().m_DRCEngine->ClearViolationHandler();
72 {
"issue14549_2", 0 },
86 BOOST_REQUIRE_MESSAGE( m_board,
"Failed to load board for test: " +
test.first.ToStdString() );
90 std::vector<DRC_ITEM> violations;
94 BOOST_REQUIRE_MESSAGE( bds.
m_DRCEngine,
"DRC engine not initialized for test: " +
test.first.ToStdString() );
104 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
105 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
108 violations.push_back( *aItem );
111 BOOST_TEST_CHECKPOINT(
"Running copper sliver drc" );
119 std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
121 BOOST_TEST_CHECKPOINT(
"DRC engine run completed successfully" );
123 catch(
const std::exception& e )
125 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, exception during RunTests: %s",
126 test.first, e.what() ) );
131 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, unknown exception during RunTests",
137 BOOST_TEST_CHECKPOINT(
"Clearing violation handler" );
140 if( violations.size() ==
test.second )
149 std::map<KIID, EDA_ITEM*> itemMap;
154 m_board->FillItemMap( itemMap );
156 catch(
const std::exception& e )
158 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, exception in FillItemMap: %s",
159 test.first, e.what() ) );
164 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, unknown exception in FillItemMap",
170 for(
size_t i = 0; i < violations.size() && i < 100; ++i )
174 const DRC_ITEM& item = violations[i];
177 catch(
const std::exception& e )
179 BOOST_TEST_MESSAGE( wxString::Format(
"Error reporting violation %zu: %s", i, e.what() ) );
187 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, failed (violations found %d "
190 (
int) violations.size(),
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)
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).
void ClearViolationHandler()
virtual wxString ShowReport(UNITS_PROVIDER *aUnitsProvider, SEVERITY aSeverity, const std::map< KIID, EDA_ITEM * > &aItemMap) const
Translate this object into a text string suitable for saving to disk in a report.
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()
~DRC_REGRESSION_TEST_FIXTURE()
std::unique_ptr< BOARD > m_board
static const std::vector< std::pair< wxString, int > > DRCCopperSliver_cases
BOOST_DATA_TEST_CASE_F(DRC_REGRESSION_TEST_FIXTURE, DRCCopperSliver, boost::unit_test::data::make(DRCCopperSliver_cases), test)
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I