29LIB_ID makeFp(
const wxString& aLibNick,
const wxString& aName )
33 id.SetLibItemName( aName );
47 BOOST_CHECK( !map.
HasEntry( wxS(
"1" ) ) );
49 map.
SetEntry( wxS(
"1" ), wxS(
"1" ) );
50 map.
SetEntry( wxS(
"4" ), wxS(
"[4,9]" ) );
52 BOOST_CHECK( map.
HasEntry( wxS(
"1" ) ) );
58 BOOST_CHECK( map.
GetPadNumber( wxS(
"99" ) ).IsEmpty() );
61 map.
SetEntry( wxS(
"1" ), wxS(
"8" ) );
66 BOOST_CHECK( !map.
HasEntry( wxS(
"1" ) ) );
77 const std::vector<wxString> pins = { wxS(
"1" ), wxS(
"2" ), wxS(
"4" ) };
80 BOOST_CHECK(
empty.IsIdentity( pins ) );
82 PIN_MAP straight( wxS(
"Straight" ) );
83 straight.
SetEntry( wxS(
"1" ), wxS(
"1" ) );
84 straight.
SetEntry( wxS(
"2" ), wxS(
"2" ) );
88 swap.SetEntry( wxS(
"1" ), wxS(
"2" ) );
89 swap.SetEntry( wxS(
"2" ), wxS(
"1" ) );
90 BOOST_CHECK( !
swap.IsIdentity( pins ) );
94 PIN_MAP stacked( wxS(
"Stacked" ) );
95 stacked.
SetEntry( wxS(
"4" ), wxS(
"[4,9]" ) );
110 BOOST_CHECK( set.
FindByName( wxS(
"missing" ) ) ==
nullptr );
113 PIN_MAP replacement( wxS(
"STD-8" ) );
114 replacement.
SetEntry( wxS(
"1" ), wxS(
"1" ) );
118 BOOST_CHECK( set.
FindByName( wxS(
"STD-8" ) )->HasEntry( wxS(
"1" ) ) );
120 set.
Remove( wxS(
"DFN-8-EP" ) );
122 BOOST_CHECK( set.
FindByName( wxS(
"DFN-8-EP" ) ) ==
nullptr );
149 std::unordered_map<wxString, std::vector<wxString>> assignments;
150 assignments[wxS(
"1" )] = { wxS(
"1" ) };
151 assignments[wxS(
"4" )] = { wxS(
"4" ), wxS(
"9" ) };
152 assignments[wxS(
"7" )] = {};
159 BOOST_CHECK( !map.
HasEntry( wxS(
"7" ) ) );
163 BOOST_CHECK( map == httpMap );
173 ov.
m_Edits.push_back( { wxS(
"1" ), wxS(
"8" ) } );
192 BOOST_CHECK( a == b );
194 a.
SetEntry( wxS(
"1" ), wxS(
"1" ) );
195 BOOST_CHECK( !( a == b ) );
197 b.
SetEntry( wxS(
"1" ), wxS(
"1" ) );
198 BOOST_CHECK( a == b );
202 BOOST_CHECK( !( a == b ) );
207 BOOST_CHECK( fa == fb );
209 fb.m_MapName = wxS(
"OTHER" );
210 BOOST_CHECK( !( fa == fb ) );
220 map.SetEntry( wxS(
"1" ), wxS(
"8" ) );
231 root.
SetPinMaps( makeSet( wxS(
"ROOT-MAP" ) ) );
263 root.
SetPinMaps( makeSet( wxS(
"ROOT-MAP" ) ) );
269 std::unique_ptr<LIB_SYMBOL> flat = leaf.
Flatten();
272 BOOST_CHECK( !flat->IsDerived() );
273 BOOST_REQUIRE( flat->GetPinMaps().FindByName( wxS(
"ROOT-MAP" ) ) );
283 { makeFp( wxS(
"Package_SO" ), wxS(
"SOIC-8" ) ), wxS(
"STD-8" ) },
284 { makeFp( wxS(
"Package_SO" ), wxS(
"VSSOP-8" ) ), wxS(
"STD-8" ) },
307 BOOST_CHECK( a.
Compare( b ) != 0 );
313 BOOST_CHECK( b.
Compare( c ) != 0 );
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Define a library symbol object.
const std::vector< ASSOCIATED_FOOTPRINT > & GetEffectiveAssociatedFootprints() const
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0, REPORTER *aReporter=nullptr) const
Comparison test that can be used for operators.
void SetAssociatedFootprints(std::vector< ASSOCIATED_FOOTPRINT > aList)
void SetParent(LIB_SYMBOL *aParent=nullptr)
void SetPinMaps(const PIN_MAP_SET &aPinMaps)
const PIN_MAP_SET & GetEffectivePinMaps() const
const PIN_MAP_SET & GetPinMaps() const
Pin-to-pad mapping (issue #2282).
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
const std::vector< ASSOCIATED_FOOTPRINT > & GetAssociatedFootprints() const
A symbol-owned ordered set of named pin maps.
const std::vector< PIN_MAP > & GetAll() const
void AddOrReplace(PIN_MAP aMap)
Insert aMap, replacing any existing entry with the same name.
void Remove(const wxString &aName)
Remove the map with the given name.
const PIN_MAP * FindByName(const wxString &aName) const
void SetName(const wxString &aName)
const wxString & GetPadNumber(const wxString &aPinNumber) const
const std::vector< PIN_MAP_ENTRY > & GetEntries() const
const wxString & GetName() const
bool HasEntry(const wxString &aPinNumber) const
void ClearEntry(const wxString &aPinNumber)
Remove the entry for aPinNumber.
bool IsIdentity(const std::vector< wxString > &aPinNumbers) const
void SetEntry(const wxString &aPinNumber, const wxString &aPadNumber)
Set the pad number for a symbol pin.
static bool empty(const wxTextEntryBase *aCtrl)
PIN_MAP MakeLegacyPinMap(const wxString &aName, const std::unordered_map< wxString, std::vector< wxString > > &aAssignments)
Build a single named PIN_MAP from a legacy symbol-pin to footprint-pad(s) assignment table (the flat ...
Per-instance override of the active pin map and a sparse delta on top.
std::vector< PIN_MAP_ENTRY > m_Edits
PIN_MAP_OVERRIDE_MODE m_Mode
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(EntrySetGetClear)
BOOST_CHECK_EQUAL(result, "25.4")