75 m_schematic->ConnectionGraph()->RunERC();
89 BOOST_CHECK_MESSAGE( multiUnitErrors > 0,
90 "Expected ERC to detect shared pin on different nets.\n"
94 bool foundDifferentUnitNetError =
false;
96 for(
int i = 0; i < errors.
GetCount(); ++i )
98 std::shared_ptr<RC_ITEM> item = errors.
GetItem( i );
102 foundDifferentUnitNetError =
true;
107 BOOST_CHECK_MESSAGE( foundDifferentUnitNetError,
108 "Expected ERCE_DIFFERENT_UNIT_NET error for shared pin 2.\n"
118 std::vector<PIN_INFO> pins;
122 pins.emplace_back( wxT(
"2" ), wxT(
"unconnected-(VD1A-A-Pad2)" ), wxT(
"A" ) );
123 pins.emplace_back( wxT(
"2" ), wxT(
"GND" ), wxT(
"A" ) );
124 pins.emplace_back( wxT(
"3" ), wxT(
"Net-(VD1-K)" ), wxT(
"K" ) );
127 auto isAutoGeneratedNet = [](
const wxString& aNetName ) ->
bool
129 return aNetName.StartsWith( wxT(
"unconnected-(" ) )
130 || aNetName.StartsWith( wxT(
"Net-(" ) );
134 for(
unsigned ii = 0; ii < pins.size(); ii++ )
136 if( pins[ii].num.empty() )
139 unsigned idxBest = ii;
141 for(
unsigned jj = ii + 1; jj < pins.size(); jj++ )
143 if( pins[jj].num.empty() )
146 if( pins[idxBest].num != pins[jj].num )
149 bool bestIsAuto = isAutoGeneratedNet( pins[idxBest].netName );
150 bool jjIsAuto = isAutoGeneratedNet( pins[jj].netName );
152 if( bestIsAuto && !jjIsAuto )
154 pins[idxBest].num.clear();
159 pins[jj].num.clear();
165 std::vector<PIN_INFO>
result;
169 if( !
pin.num.empty() )
174 BOOST_REQUIRE_EQUAL(
result.size(), 2 );
190 std::vector<PIN_INFO> pins;
193 pins.emplace_back( wxT(
"2" ), wxT(
"GND" ), wxT(
"A" ) );
194 pins.emplace_back( wxT(
"2" ), wxT(
"unconnected-(VD1A-A-Pad2)" ), wxT(
"A" ) );
196 auto isAutoGeneratedNet = [](
const wxString& aNetName ) ->
bool
198 return aNetName.StartsWith( wxT(
"unconnected-(" ) )
199 || aNetName.StartsWith( wxT(
"Net-(" ) );
202 for(
unsigned ii = 0; ii < pins.size(); ii++ )
204 if( pins[ii].num.empty() )
207 unsigned idxBest = ii;
209 for(
unsigned jj = ii + 1; jj < pins.size(); jj++ )
211 if( pins[jj].num.empty() )
214 if( pins[idxBest].num != pins[jj].num )
217 bool bestIsAuto = isAutoGeneratedNet( pins[idxBest].netName );
218 bool jjIsAuto = isAutoGeneratedNet( pins[jj].netName );
220 if( bestIsAuto && !jjIsAuto )
222 pins[idxBest].num.clear();
227 pins[jj].num.clear();
232 std::vector<PIN_INFO>
result;
236 if( !
pin.num.empty() )
240 BOOST_REQUIRE_EQUAL(
result.size(), 1 );
wxString GetTextReport()
Returns the ERC report in "text" (human readable) format in the C-locale.
Container for ERC settings.
std::map< int, SEVERITY > m_ERCSeverities
int TestMultUnitPinConflicts()
Checks if shared pins on multi-unit symbols have been connected to different nets.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
An implementation of the RC_ITEM_LIST interface which uses the global SHEETLIST to fulfill the contra...
int GetCount(int aSeverity=-1) const override
void SetSeverities(int aSeverities) override
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
@ ERCE_DIFFERENT_UNIT_NET
Shared pin in a multi-unit symbol is connected to more than one net.
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
std::vector< FAB_LAYER_COLOR > dummy
ERC_SHARED_PIN_TEST_FIXTURE()=default
std::unique_ptr< SCHEMATIC > m_schematic
SETTINGS_MANAGER m_settingsManager
BOOST_AUTO_TEST_CASE(Issue1768_NetlistPreferUserNet)
BOOST_FIXTURE_TEST_CASE(Issue1768_SharedPinDifferentNets, ERC_SHARED_PIN_TEST_FIXTURE)
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")