61 for(
RULE_AREA& ra : aTool->GetData()->m_areas )
63 if( ra.m_ruleName.Contains( ( aName ) ) )
75 std::vector<wxString> tests = {
"vme-wren" };
77 for(
const wxString& relPath : tests )
84 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
93 auto ruleData = mtTool->
GetData();
96 static_cast<int>( ruleData->m_areas.size() ) ) );
102 ruleData->m_replaceExisting =
true;
107 || ra.
m_sheetName == wxT(
"pp_driver_2x.kicad_sch" ) )
121 int n_areas_io = 0, n_areas_pp = 0, n_areas_other = 0;
124 static_cast<int>(ruleData->m_areas.size() ) ) );
126 for(
const RULE_AREA& ra : ruleData->m_areas )
130 if( ra.
m_ruleName.Contains( wxT(
"io_drivers_fp" ) ) )
135 else if( ra.
m_ruleName.Contains( wxT(
"io_drivers_pp" ) ) )
147 n_areas_io, n_areas_pp, n_areas_other ) );
153 const std::vector<wxString> rulesToTest = { wxT(
"io_drivers_fp" ),
154 wxT(
"io_drivers_pp" ) };
156 for(
const wxString& ruleName : rulesToTest )
158 for(
const RULE_AREA& refArea : ruleData->m_areas )
160 if( !refArea.
m_ruleName.Contains( ruleName ) )
165 for(
const RULE_AREA& targetArea : ruleData->m_areas )
170 if( !targetArea.
m_ruleName.Contains( ruleName ) )
173 auto cgRef = CONNECTION_GRAPH::BuildFromFootprintSet( refArea.
m_components );
175 CONNECTION_GRAPH::BuildFromFootprintSet( targetArea.
m_components );
179 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> details;
180 bool status = cgRef->FindIsomorphism( cgTarget.get(),
result, details );
183 "topo match: '%s' [%d] -> '%s' [%d] result %d", refArea.
m_ruleName.c_str().AsChar(),
185 static_cast<int>( targetArea.
m_components.size() ), status ? 1 : 0 ) );
187 for(
const auto& iter :
result )
190 iter.second->GetReference(),
191 iter.first->GetReference() ) );
194 BOOST_CHECK( status );
195 BOOST_CHECK( details.empty() );
202 BOOST_ASSERT( refArea );
204 const std::vector<wxString> targetAreaNames( { wxT(
"io_drivers_fp/bank2/io78/" ),
205 wxT(
"io_drivers_fp/bank1/io78/" ),
206 wxT(
"io_drivers_fp/bank0/io01/" ) } );
208 for(
const wxString& targetRaName : targetAreaNames )
212 BOOST_ASSERT( targetRA !=
nullptr );
216 ruleData->m_compatMap[targetRA].m_doCopy =
true;
221 BOOST_ASSERT(
result >= 0 );
237 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
244 auto ruleData = mtTool->
GetData();
247 static_cast<int>( ruleData->m_areas.size() ) ) );
249 BOOST_CHECK( ruleData->m_areas.size() >= 2 );
251 if( ruleData->m_areas.size() < 2 )
259 if( ra.
m_ruleName.Contains( wxT(
"Untitled Sheet/" ) ) )
261 else if( ra.
m_ruleName.Contains( wxT(
"Untitled Sheet1/" ) ) )
265 if( !refArea || !targetArea )
267 BOOST_TEST_MESSAGE(
"Could not find Untitled Sheet and Untitled Sheet1 rule areas, skipping test" );
295 if( !refFP || !targetFP )
297 BOOST_TEST_MESSAGE(
"Could not find matching footprints in the rule areas, skipping test" );
302 bool refValueVisible = refValueField ? refValueField->
IsVisible() :
true;
304 std::vector<FP_3DMODEL> refModels = refFP->
Models();
308 ruleData->m_compatMap[targetArea].m_doCopy =
true;
309 ruleData->m_options.m_copyPlacement =
true;
313 BOOST_CHECK(
result >= 0 );
317 if( targetValueField && refValueField )
321 refValueVisible, targetValueField->
IsVisible() ) );
326 if( !refModels.empty() )
329 static_cast<int>( refModels.size() ),
330 static_cast<int>( targetFP->
Models().size() ) ) );
349 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
356 auto ruleData = mtTool->
GetData();
359 static_cast<int>( ruleData->m_areas.size() ) ) );
363 if( ruleData->m_areas.size() < 2 )
380 int refViaCountBefore = 0;
382 for(
PCB_TRACK* track : m_board->Tracks() )
394 BOOST_TEST_MESSAGE( wxString::Format(
"Reference area vias before repeat: %d", refViaCountBefore ) );
395 BOOST_CHECK( refViaCountBefore > 0 );
399 ruleData->m_compatMap[targetArea].m_doCopy =
true;
400 ruleData->m_options.m_copyPlacement =
true;
401 ruleData->m_options.m_copyRouting =
true;
405 BOOST_CHECK(
result >= 0 );
407 int refViaCountAfter = 0;
409 for(
PCB_TRACK* track : m_board->Tracks() )
421 BOOST_TEST_MESSAGE( wxString::Format(
"Reference area vias after repeat: %d", refViaCountAfter ) );
440 auto cgRef = std::make_unique<CONNECTION_GRAPH>();
441 auto cgTarget = std::make_unique<CONNECTION_GRAPH>();
444 LIB_ID fpid( wxT(
"Package_SO" ), wxT(
"SOIC-8_3.9x4.9mm_P1.27mm" ) );
456 PAD padRef1( &fpRef );
459 fpRef.
Add( &padRef1 );
461 PAD padRef2( &fpRef );
464 fpRef.
Add( &padRef2 );
466 PAD padTarget1( &fpTarget );
469 fpTarget.
Add( &padTarget1 );
471 PAD padTarget2( &fpTarget );
474 fpTarget.
Add( &padTarget2 );
477 cgRef->AddFootprint( &fpRef,
VECTOR2I( 0, 0 ) );
478 cgTarget->AddFootprint( &fpTarget,
VECTOR2I( 0, 0 ) );
480 cgRef->BuildConnectivity();
481 cgTarget->BuildConnectivity();
487 COMPONENT* cmpRef = cgRef->Components()[0];
488 COMPONENT* cmpTarget = cgTarget->Components()[0];
490 bool sameKind = cmpRef->IsSameKind( *cmpTarget );
492 BOOST_TEST_MESSAGE( wxString::Format(
"TRIM_1.1 and TRIM_2.1 IsSameKind: %d", sameKind ? 1 : 0 ) );
493 BOOST_CHECK( sameKind );
497 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> details;
498 bool status = cgRef->FindIsomorphism( cgTarget.get(),
result, details );
500 BOOST_TEST_MESSAGE( wxString::Format(
"Topology match result: %d", status ? 1 : 0 ) );
502 if( !status && !details.empty() )
504 for(
const auto& reason : details )
507 reason.m_reference, reason.m_candidate, reason.m_reason ) );
511 BOOST_CHECK( status );
512 BOOST_CHECK( details.empty() );
515 fpRef.
Pads().clear();
516 fpTarget.
Pads().clear();
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
Store all of the related component information found in a netlist.
virtual bool IsVisible() const
A logical library item identifier and consists of various portions much like a URI.
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
SHAPE_POLY_SET * Outline()
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
std::map< FOOTPRINT *, FOOTPRINT * > COMPONENT_MATCHES
MULTICHANNEL_TEST_FIXTURE()
SETTINGS_MANAGER m_settingsManager
std::unique_ptr< BOARD > m_board
std::set< FOOTPRINT * > m_components
@ VALUE
Field Value of part, i.e. "3.3K".
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
RULE_AREA * findRuleAreaByPartialName(MULTICHANNEL_TOOL *aTool, const wxString &aName)
BOOST_FIXTURE_TEST_CASE(MultichannelToolRegressions, MULTICHANNEL_TEST_FIXTURE)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
VECTOR2< int32_t > VECTOR2I