20#include <boost/test/unit_test.hpp>
36 const std::pair<std::pair<wxString, wxString>,
37 std::pair<wxString, wxString>>& aTerms,
38 const std::map<std::pair<wxString, wxString>, wxString>& aRefPinToNet,
39 const std::vector<std::unique_ptr<SCH_NETCHAIN>>& aPotentials,
40 const wxString& aChainName )
43 { aTerms.first.first, aTerms.first.second },
44 { aTerms.second.first, aTerms.second.second }
48 aPotentials, aChainName );
68 std::initializer_list<wxString> aNets )
70 auto sig = std::make_unique<SCH_NETCHAIN>();
71 sig->SetName( aName );
73 for(
const wxString& n : aNets )
83 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/SHARED" );
84 refPinToNet[{ wxT(
"U3" ), wxT(
"5" ) }] = wxT(
"/TARGET_TO" );
86 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
90 potentials.push_back(
makePotential( wxT(
"potA" ), { wxT(
"/SHARED" ), wxT(
"/OTHER_TO" ) } ) );
93 potentials.push_back(
makePotential( wxT(
"potB" ), { wxT(
"/SHARED" ), wxT(
"/TARGET_TO" ) } ) );
96 { wxT(
"U1" ), wxT(
"1" ) },
97 { wxT(
"U3" ), wxT(
"5" ) }
101 terms, refPinToNet, potentials, wxT(
"TEST_CHAIN" ) );
111 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/SHARED" );
112 refPinToNet[{ wxT(
"U3" ), wxT(
"5" ) }] = wxT(
"/TARGET_TO" );
114 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
115 potentials.push_back(
makePotential( wxT(
"potA" ), { wxT(
"/SHARED" ), wxT(
"/OTHER" ) } ) );
116 potentials.push_back(
makePotential( wxT(
"potB" ), { wxT(
"/UNRELATED_FROM" ),
117 wxT(
"/TARGET_TO" ) } ) );
120 { wxT(
"U1" ), wxT(
"1" ) },
121 { wxT(
"U3" ), wxT(
"5" ) }
125 terms, refPinToNet, potentials, wxT(
"TEST_CHAIN" ) );
127 BOOST_CHECK( match ==
nullptr );
134 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/SHARED" );
136 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
137 potentials.push_back(
makePotential( wxT(
"potA" ), { wxT(
"/SHARED" ), wxT(
"/X" ) } ) );
140 { wxT(
"U1" ), wxT(
"1" ) },
141 { wxT(
"MISSING" ), wxT(
"9" ) }
145 terms, refPinToNet, potentials, wxT(
"TEST_CHAIN" ) );
147 BOOST_CHECK( match ==
nullptr );
154 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/A" );
155 refPinToNet[{ wxT(
"U2" ), wxT(
"2" ) }] = wxT(
"/B" );
157 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
158 potentials.push_back(
makePotential( wxT(
"pot" ), { wxT(
"/A" ), wxT(
"/B" ) } ) );
161 { wxT(
"U2" ), wxT(
"2" ) },
162 { wxT(
"U1" ), wxT(
"1" ) }
166 terms, refPinToNet, potentials, wxT(
"pot" ) );
181 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/NAMED_SIDE" );
182 refPinToNet[{ wxT(
"U2" ), wxT(
"2" ) }] = wxT(
"__SG_42" );
184 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
186 { wxT(
"/NAMED_SIDE" ), wxT(
"__SG_42" ) } ) );
189 { wxT(
"U1" ), wxT(
"1" ) },
190 { wxT(
"U2" ), wxT(
"2" ) }
194 terms, refPinToNet, potentials, wxT(
"TEST_CHAIN" ) );
static SCH_NETCHAIN * resolvePotentialChainByTerminals(const CHAIN_TERMINAL_REFS &aTermRefs, const std::map< std::pair< wxString, wxString >, wxString > &aRefPinToNet, const std::vector< std::unique_ptr< SCH_NETCHAIN > > &aPotentials, const wxString &aChainName)
Disambiguate the saved (refA.pinA, refB.pinB) terminal pair against the current set of potential net ...
std::pair< CHAIN_TERMINAL_REF, CHAIN_TERMINAL_REF > CHAIN_TERMINAL_REFS
A net chain is a collection of nets that are connected together through passive components.
const wxString & GetName() const
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
static std::unique_ptr< SCH_NETCHAIN > makePotential(const wxString &aName, std::initializer_list< wxString > aNets)
std::pair< REF_PIN_KEY, REF_PIN_KEY > TERM_PAIR
std::map< REF_PIN_KEY, wxString > REF_PIN_TO_NET
SCH_NETCHAIN * boost_test_resolve_potential_chain_by_terminals(const std::pair< std::pair< wxString, wxString >, std::pair< wxString, wxString > > &aTerms, const std::map< std::pair< wxString, wxString >, wxString > &aRefPinToNet, const std::vector< std::unique_ptr< SCH_NETCHAIN > > &aPotentials, const wxString &aChainName)
BOOST_AUTO_TEST_CASE(PicksChainContainingBothTerminalNets)
std::pair< wxString, wxString > REF_PIN_KEY
Regression for [H-5].
BOOST_CHECK_EQUAL(result, "25.4")