21#include <boost/test/unit_test.hpp>
37 const std::pair<std::pair<wxString, wxString>,
38 std::pair<wxString, wxString>>& aTerms,
39 const std::map<std::pair<wxString, wxString>, wxString>& aRefPinToNet,
40 const std::vector<std::unique_ptr<SCH_NETCHAIN>>& aPotentials,
41 const wxString& aChainName )
44 { aTerms.first.first, aTerms.first.second },
45 { aTerms.second.first, aTerms.second.second }
49 aPotentials, aChainName );
69 std::initializer_list<wxString> aNets )
71 auto sig = std::make_unique<SCH_NETCHAIN>();
72 sig->SetName( aName );
74 for(
const wxString& n : aNets )
84 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/SHARED" );
85 refPinToNet[{ wxT(
"U3" ), wxT(
"5" ) }] = wxT(
"/TARGET_TO" );
87 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
91 potentials.push_back(
makePotential( wxT(
"potA" ), { wxT(
"/SHARED" ), wxT(
"/OTHER_TO" ) } ) );
94 potentials.push_back(
makePotential( wxT(
"potB" ), { wxT(
"/SHARED" ), wxT(
"/TARGET_TO" ) } ) );
97 { wxT(
"U1" ), wxT(
"1" ) },
98 { wxT(
"U3" ), wxT(
"5" ) }
102 terms, refPinToNet, potentials, wxT(
"TEST_CHAIN" ) );
112 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/SHARED" );
113 refPinToNet[{ wxT(
"U3" ), wxT(
"5" ) }] = wxT(
"/TARGET_TO" );
115 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
116 potentials.push_back(
makePotential( wxT(
"potA" ), { wxT(
"/SHARED" ), wxT(
"/OTHER" ) } ) );
117 potentials.push_back(
makePotential( wxT(
"potB" ), { wxT(
"/UNRELATED_FROM" ),
118 wxT(
"/TARGET_TO" ) } ) );
121 { wxT(
"U1" ), wxT(
"1" ) },
122 { wxT(
"U3" ), wxT(
"5" ) }
126 terms, refPinToNet, potentials, wxT(
"TEST_CHAIN" ) );
128 BOOST_CHECK( match ==
nullptr );
135 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/SHARED" );
137 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
138 potentials.push_back(
makePotential( wxT(
"potA" ), { wxT(
"/SHARED" ), wxT(
"/X" ) } ) );
141 { wxT(
"U1" ), wxT(
"1" ) },
142 { wxT(
"MISSING" ), wxT(
"9" ) }
146 terms, refPinToNet, potentials, wxT(
"TEST_CHAIN" ) );
148 BOOST_CHECK( match ==
nullptr );
155 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/A" );
156 refPinToNet[{ wxT(
"U2" ), wxT(
"2" ) }] = wxT(
"/B" );
158 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
159 potentials.push_back(
makePotential( wxT(
"pot" ), { wxT(
"/A" ), wxT(
"/B" ) } ) );
162 { wxT(
"U2" ), wxT(
"2" ) },
163 { wxT(
"U1" ), wxT(
"1" ) }
167 terms, refPinToNet, potentials, wxT(
"pot" ) );
182 refPinToNet[{ wxT(
"U1" ), wxT(
"1" ) }] = wxT(
"/NAMED_SIDE" );
183 refPinToNet[{ wxT(
"U2" ), wxT(
"2" ) }] = wxT(
"__SG_42" );
185 std::vector<std::unique_ptr<SCH_NETCHAIN>> potentials;
187 { wxT(
"/NAMED_SIDE" ), wxT(
"__SG_42" ) } ) );
190 { wxT(
"U1" ), wxT(
"1" ) },
191 { wxT(
"U2" ), wxT(
"2" ) }
195 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")