74 m_schematic->ConnectionGraph()->RunERC();
89 "Expected ERC to detect shared pin on different nets.\n"
93 bool foundDifferentUnitNetError =
false;
95 for(
int i = 0; i < errors.
GetCount(); ++i )
97 std::shared_ptr<RC_ITEM> item = errors.
GetItem( i );
101 foundDifferentUnitNetError =
true;
107 "Expected ERCE_DIFFERENT_UNIT_NET error for shared pin 2.\n"
117 std::vector<PIN_INFO> pins;
121 pins.emplace_back( wxT(
"2" ), wxT(
"unconnected-(VD1A-A-Pad2)" ), wxT(
"A" ) );
122 pins.emplace_back( wxT(
"2" ), wxT(
"GND" ), wxT(
"A" ) );
123 pins.emplace_back( wxT(
"3" ), wxT(
"Net-(VD1-K)" ), wxT(
"K" ) );
126 auto isAutoGeneratedNet = [](
const wxString& aNetName ) ->
bool
128 return aNetName.StartsWith( wxT(
"unconnected-(" ) )
129 || aNetName.StartsWith( wxT(
"Net-(" ) );
133 for(
unsigned ii = 0; ii < pins.size(); ii++ )
135 if( pins[ii].num.empty() )
138 unsigned idxBest = ii;
140 for(
unsigned jj = ii + 1; jj < pins.size(); jj++ )
142 if( pins[jj].num.empty() )
145 if( pins[idxBest].num != pins[jj].num )
148 bool bestIsAuto = isAutoGeneratedNet( pins[idxBest].netName );
149 bool jjIsAuto = isAutoGeneratedNet( pins[jj].netName );
151 if( bestIsAuto && !jjIsAuto )
153 pins[idxBest].num.clear();
158 pins[jj].num.clear();
164 std::vector<PIN_INFO>
result;
168 if( !
pin.num.empty() )
173 BOOST_REQUIRE_EQUAL(
result.size(), 2 );
189 std::vector<PIN_INFO> pins;
192 pins.emplace_back( wxT(
"2" ), wxT(
"GND" ), wxT(
"A" ) );
193 pins.emplace_back( wxT(
"2" ), wxT(
"unconnected-(VD1A-A-Pad2)" ), wxT(
"A" ) );
195 auto isAutoGeneratedNet = [](
const wxString& aNetName ) ->
bool
197 return aNetName.StartsWith( wxT(
"unconnected-(" ) )
198 || aNetName.StartsWith( wxT(
"Net-(" ) );
201 for(
unsigned ii = 0; ii < pins.size(); ii++ )
203 if( pins[ii].num.empty() )
206 unsigned idxBest = ii;
208 for(
unsigned jj = ii + 1; jj < pins.size(); jj++ )
210 if( pins[jj].num.empty() )
213 if( pins[idxBest].num != pins[jj].num )
216 bool bestIsAuto = isAutoGeneratedNet( pins[idxBest].netName );
217 bool jjIsAuto = isAutoGeneratedNet( pins[jj].netName );
219 if( bestIsAuto && !jjIsAuto )
221 pins[idxBest].num.clear();
226 pins[jj].num.clear();
231 std::vector<PIN_INFO>
result;
235 if( !
pin.num.empty() )
239 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)
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")