41struct ERC_REGRESSION_TEST_FIXTURE
43 ERC_REGRESSION_TEST_FIXTURE() {}
45 SETTINGS_MANAGER m_settingsManager;
46 std::unique_ptr<SCHEMATIC> m_schematic;
57 std::vector<std::pair<wxString, int>> tests = { {
"erc_multiple_pin_to_pin", 2 } };
59 for(
bool useEngine : {
false,
true } )
63 for(
const std::pair<wxString, int>&
test : tests )
70 std::set<wxString> connectors;
71 size_t powerSymbols = 0;
75 const auto* symbol =
static_cast<SCH_SYMBOL*
>( item );
76 const auto pins = symbol->
GetPins( &root );
77 BOOST_REQUIRE_EQUAL( pins.size(), 1 );
79 if( symbol->IsPower() )
84 connectors.insert( symbol->GetRef( &root ) );
88 BOOST_REQUIRE_EQUAL( powerSymbols, 14 );
89 const std::set<wxString> expectedConnectors{
"J1",
"J2" };
99 m_schematic->ConnectionGraph()->RunERC();
113 "Expected " <<
test.second <<
" errors in " <<
test.first.ToStdString()
114 <<
" but got " << errors.
GetCount() <<
"\n"
127 using DIAGNOSTIC = std::tuple<int, KIID, KIID, KIID_PATH>;
129 const std::vector<std::pair<wxString, CHECK>> cases = {
135 for(
const auto& [fixture, check] : cases )
141 for(
bool published : {
false,
true } )
146 m_schematic->RebuildConnectivity();
149 m_schematic->ConnectionGraph()->Reset();
155 std::multiset<DIAGNOSTIC>
actual;
157 for(
size_t i = 0; i < errors.
GetCount(); ++i )
159 const auto item = std::static_pointer_cast<ERC_ITEM>( errors.
GetItem( i ) );
160 actual.emplace( item->GetErrorCode(), item->GetMainItemID(), item->GetAuxItemID(),
161 item->IsSheetSpecific() ? item->GetSpecificSheetPath().Path() :
KIID_PATH() );
173 "Published diagnostics: " <<
actual.size() <<
", legacy: " <<
expected.size()
188 for(
bool published : {
false,
true } )
196 std::vector<SCH_PIN*> pins;
197 std::vector<SCH_ITEM*> flags;
202 pins.push_back(
pin );
206 flags.push_back( item );
208 BOOST_REQUIRE_EQUAL( pins.size(), 1 );
209 BOOST_REQUIRE_EQUAL( flags.size(), 1 );
212 for(
bool flagged : {
true,
false } )
217 m_schematic->RebuildConnectivity();
220 m_schematic->ConnectionGraph()->Reset();
226 BOOST_REQUIRE_EQUAL( errors.
GetCount(), flagged ? 0 : 1 );
248 auto* candidate =
static_cast<SCH_SYMBOL*
>( item );
250 if( candidate->GetRef( &
path ) == wxS(
"U1" ) )
256 BOOST_REQUIRE_EQUAL( pins.size(), 2 );
257 pins[1]->SetNumber( pins[0]->GetNumber() );
259 for(
bool backend : {
false,
true } )
261 for(
bool jumpered : {
false,
true } )
267 m_schematic->RebuildConnectivity();
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
EE_TYPE OfType(KICAD_T aType) const
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
Runs the electrical rules checks and adds a SCH_MARKER for each violation.
int TestPinToPin()
Checks the full netlist against the pin-to-pin connectivity requirements.
int TestSimilarLabels()
Checks for labels that differ only in capitalization.
int TestSameLocalGlobalLabel()
Checks for global and local labels with the same name.
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 TestDuplicatePinNets()
Checks if duplicate pin numbers within a symbol are connected to different nets.
int TestMultiunitFootprints()
Test if all units of each multiunit symbol have the same footprint assigned.
void SetDuplicatePinNumbersAreJumpers(bool aEnabled)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void DeleteAllMarkers(enum MARKER_BASE::MARKER_T aMarkerType, bool aIncludeExclusions)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
void DeleteItem(SCH_ITEM *aItem)
Remove aItem from the linked list and deletes the object.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
RAII class that sets an value at construction and resets it to the original value at destruction.
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_SAME_LOCAL_GLOBAL_LABEL
2 labels are equal for case insensitive comparisons.
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_PIN_NOT_DRIVEN
Pin connected to some others pins but no pin to drive it.
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
@ PT_INPUT
usual pin input: must be connected
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
std::vector< FAB_LAYER_COLOR > dummy
BOOST_FIXTURE_TEST_CASE(ERCMultiplePinToPin, ERC_REGRESSION_TEST_FIXTURE)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
VECTOR3I expected(15, 30, 45)
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_CHECK_EQUAL(result, "25.4")