77 m_schematic->ConnectionGraph()->RunERC();
87 "Expected 1 ERCE_GROUND_PIN_NOT_GROUND error but got "
91 bool foundGroundPinError =
false;
92 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
96 foundGroundPinError =
true;
102 "Expected to find ERCE_GROUND_PIN_NOT_GROUND error\n"
128 m_schematic->ConnectionGraph()->RunERC();
138 int groundPinErrors = 0;
139 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
148 "Expected 0 ERCE_GROUND_PIN_NOT_GROUND errors but got "
149 << groundPinErrors <<
"\n" << reportWriter.
GetTextReport() );
176 m_schematic->ConnectionGraph()->RunERC();
186 int groundPinErrors = 0;
187 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
196 "Expected 1 ERCE_GROUND_PIN_NOT_GROUND error but got "
197 << groundPinErrors <<
"\n" << reportWriter.
GetTextReport() );
224 m_schematic->ConnectionGraph()->RunERC();
234 int groundPinErrors = 0;
235 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
244 "Expected 0 ERCE_GROUND_PIN_NOT_GROUND errors but got "
245 << groundPinErrors <<
"\n" << reportWriter.
GetTextReport() );
266 int groundPinErrors = 0;
270 m_schematic->ConnectionGraph()->RunERC();
277 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
286 "Expected 0 errors when test is disabled but got " << groundPinErrors );
290 m_schematic->ConnectionGraph()->RunERC();
298 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
307 "Expected at least 1 error when test is enabled but got " << groundPinErrors );
331 m_schematic->ConnectionGraph()->RunERC();
339 bool foundGroundPinError =
false;
340 wxString errorMessage;
342 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
346 foundGroundPinError =
true;
351 "Error message should contain 'Pin': " << errorMessage.ToStdString() );
354 "Error message should contain 'GND': " << errorMessage.ToStdString() );
357 "Error message should contain expected text: " << errorMessage.ToStdString() );
360 std::shared_ptr<RC_ITEM> ercItem = errors.
GetItem( i );
362 "ERC item should have a main item (the pin)" );
369 "Should have found a ground pin error to test message content" );
391 m_schematic->ConnectionGraph()->RunERC();
400 int groundPinErrors = 0;
402 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
411 "Expected 0 ERCE_GROUND_PIN_NOT_GROUND errors (Earth is a valid ground net) but got "
412 << groundPinErrors <<
"\n" << reportWriter.
GetTextReport() );
425 std::vector<std::pair<wxString, int>> tests =
427 {
"ground_pin_test_error", 1 },
428 {
"ground_pin_test_ok", 0 },
429 {
"ground_pin_test_mixed", 1 },
430 {
"ground_pin_test_no_ground_net", 0 },
431 {
"ground_pin_test_earth", 0 }
434 for(
const std::pair<wxString, int>&
test : tests )
448 m_schematic->ConnectionGraph()->RunERC();
464 int groundPinErrors = 0;
465 for(
unsigned i = 0; i < errors.
GetCount(); i++ )
476 "Expected " <<
test.second <<
" ERCE_GROUND_PIN_NOT_GROUND errors in "
477 <<
test.first.ToStdString() <<
" but got " << groundPinErrors
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 TestPinToPin()
Checks the full netlist against the pin-to-pin connectivity requirements.
int TestSimilarLabels()
Checks for labels that differ only in capitalization.
int TestMultUnitPinConflicts()
Checks if shared pins on multi-unit symbols have been connected to different nets.
int TestNoConnectPins()
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
int TestGroundPins()
Checks for ground-labeled pins not on a ground net while another pin is.
int TestMissingUnits()
Test for uninstantiated units of multi unit symbols.
int TestMultiunitFootprints()
Test if all units of each multiunit symbol have the same footprint assigned.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
virtual wxString GetErrorMessage(bool aTranslate) const
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_GROUND_PIN_NOT_GROUND
A ground-labeled pin is not on a ground net while another pin is.
@ 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
SETTINGS_MANAGER m_settingsManager
std::unique_ptr< SCHEMATIC > m_schematic
ERC_GROUND_PIN_TEST_FIXTURE()
BOOST_FIXTURE_TEST_CASE(ERCGroundPinMismatch, ERC_GROUND_PIN_TEST_FIXTURE)
Test case: Pin with "GND" in its name connected to non-ground net while another pin in the same symbo...
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")