62 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
70 if( sig && sig->GetNets().size() == 4 )
72 candidate = sig.get();
77 BOOST_REQUIRE_MESSAGE( candidate,
"fixture must produce a 4-net potential chain" );
80 "potential chain must have terminal refs populated" );
90 wxFileName netFile = m_schematic->Project().GetProjectFullName();
91 netFile.SetName( netFile.GetName() + wxT(
"_terminal_pins_test" ) );
92 netFile.SetExt( wxT(
"xml" ) );
94 if( wxFileExists( netFile.GetFullPath() ) )
95 wxRemoveFile( netFile.GetFullPath() );
98 std::unique_ptr<NETLIST_EXPORTER_XML> exporter =
99 std::make_unique<NETLIST_EXPORTER_XML>( m_schematic.get() );
104 &&
reporter.GetMessages().IsEmpty() );
109 wxXmlNode* root = xdoc.GetRoot();
112 wxXmlNode* netChains =
find_child( root, wxT(
"net_chains" ) );
115 wxXmlNode* targetChain =
nullptr;
117 for( wxXmlNode* xchain = netChains->GetChildren(); xchain; xchain = xchain->GetNext() )
119 if( xchain->GetName() != wxT(
"net_chain" ) )
122 if( xchain->GetAttribute( wxT(
"name" ), wxEmptyString ) == wxT(
"SIG_TEST" ) )
124 targetChain = xchain;
129 BOOST_REQUIRE_MESSAGE( targetChain,
"expected committed chain SIG_TEST in netlist" );
131 wxXmlNode* xterminals =
find_child( targetChain, wxT(
"terminal_pins" ) );
132 BOOST_REQUIRE_MESSAGE( xterminals,
"expected terminal_pins block under net_chain" );
134 std::vector<std::pair<wxString, wxString>> emittedTerms;
136 for( wxXmlNode* xt = xterminals->GetChildren(); xt; xt = xt->GetNext() )
138 if( xt->GetName() != wxT(
"terminal_pin" ) )
141 emittedTerms.emplace_back( xt->GetAttribute( wxT(
"ref" ), wxEmptyString ),
142 xt->GetAttribute( wxT(
"pin" ), wxEmptyString ) );
147 auto matches = [](
const std::vector<std::pair<wxString, wxString>>& aTerms,
148 const wxString& aRef,
const wxString& aPin )
150 for(
const auto& t : aTerms )
152 if( t.first == aRef && t.second == aPin )
159 BOOST_CHECK( matches( emittedTerms, expectRefA, expectPinA ) );
160 BOOST_CHECK( matches( emittedTerms, expectRefB, expectPinB ) );
162 wxRemoveFile( netFile.GetFullPath() );
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Update the connection graph for the given list of sheets.
BOOST_CHECK_EQUAL(result, "25.4")