60 auto ruleData = aTool->GetData();
62 for(
auto& ra : ruleData->m_areas )
64 if( ra.m_ruleName.Contains(( aName ) ) )
74 std::vector<wxString> tests = {
78 for(
const wxString& relPath : tests )
87 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
96 auto ruleData = mtTool->
GetData();
98 printf(
"RA multichannel sheets = %d\n", (
int) ruleData->m_areas.size() );
100 BOOST_CHECK_EQUAL( ruleData->m_areas.size(), 72 );
104 ruleData->m_replaceExisting =
true;
105 for(
auto& ra : ruleData->m_areas )
107 if ( ra.m_sheetName == wxT(
"io_driver.kicad_sch") || ra.m_sheetName == wxT(
"pp_driver_2x.kicad_sch") )
109 ra.m_generateEnabled =
true;
114 printf(
"Autogenerating %d RAs\n", cnt );
121 int n_areas_io = 0, n_areas_pp = 0, n_areas_other = 0;
124 printf(
"Found %d RAs after commit\n", (
int) ruleData->m_areas.size() );
126 for(
auto ra : ruleData->m_areas )
128 printf(
"SN '%s'\n", ra.m_ruleName.c_str().AsChar() );
129 if( ra.m_ruleName.Contains( wxT(
"io_drivers_fp") ) )
132 BOOST_CHECK_EQUAL( ra.m_raFootprints.size(), 31 );
134 else if( ra.m_ruleName.Contains( wxT(
"io_drivers_pp") ) )
137 BOOST_CHECK_EQUAL( ra.m_raFootprints.size(), 11 );
145 printf(
"IO areas=%d, PP areas=%d, others=%d\n", n_areas_io, n_areas_pp, n_areas_other );
147 BOOST_CHECK_EQUAL( n_areas_io, 16 );
148 BOOST_CHECK_EQUAL( n_areas_pp, 16 );
149 BOOST_CHECK_EQUAL( n_areas_other, 0 );
151 const std::vector<wxString> rulesToTest = { wxT(
"io_drivers_fp" ), wxT(
"io_drivers_pp" ) };
153 for(
auto ruleName : rulesToTest )
155 for(
auto refArea : ruleData->m_areas )
157 if( !refArea.m_ruleName.Contains( ruleName ) )
160 printf(
"REF AREA: '%s'\n", refArea.m_ruleName.c_str().AsChar() );
162 for (
auto targetArea : ruleData->m_areas )
164 if( targetArea.m_area == refArea.m_area )
167 if( !targetArea.m_ruleName.Contains( ruleName ) )
175 auto status = cgRef->FindIsomorphism( cgTarget.get(), result );
176 printf(
"topo match: '%s' [%d] -> '%s' [%d] result %d\n",
177 refArea.m_ruleName.c_str().AsChar(),
178 (
int) refArea.m_raFootprints.size(),
179 targetArea.m_ruleName.c_str().AsChar(),
180 (
int) targetArea.m_raFootprints.size(), status );
182 for(
const auto& iter : result )
184 printf(
"%s : %s\n", iter.second->GetReference().c_str().AsChar(),
185 iter.first->GetReference().c_str().AsChar()
196 BOOST_ASSERT( refArea );
198 const std::vector<wxString> targetAreaNames ( { wxT(
"io_drivers_fp/bank2/io78/"), wxT(
"io_drivers_fp/bank1/io78/"), wxT(
"io_drivers_fp/bank0/io01/") } );
200 for( wxString targetRaName : targetAreaNames )
204 BOOST_ASSERT( targetRA !=
nullptr );
206 printf(
"Clone to: %s\n", targetRA->m_ruleName.c_str().AsChar() );
208 ruleData->m_compatMap[ targetRA ].m_doCopy =
true;
213 BOOST_ASSERT( result >= 0 );
217BOOST_AUTO_TEST_SUITE_END()
Container for design settings for a BOARD object.
static std::unique_ptr< CONNECTION_GRAPH > BuildFromFootprintSet(const std::set< FOOTPRINT * > &aFps)
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
RULE_AREA * findRuleAreaByPartialName(MULTICHANNEL_TOOL *aTool, const wxString &aName)
BOOST_FIXTURE_TEST_CASE(MultichannelToolRegressions, MULTICHANNEL_TEST_FIXTURE)