54 std::vector<std::pair<wxString, int>> tests = { {
"erc_multiple_pin_to_pin", 2 } };
56 for(
bool useEngine : {
false,
true } )
60 for(
const std::pair<wxString, int>&
test : tests )
67 std::set<wxString> connectors;
68 size_t powerSymbols = 0;
72 const auto* symbol =
static_cast<SCH_SYMBOL*
>( item );
73 const auto pins = symbol->
GetPins( &root );
74 BOOST_REQUIRE_EQUAL( pins.size(), 1 );
76 if( symbol->IsPower() )
81 connectors.insert( symbol->GetRef( &root ) );
85 BOOST_REQUIRE_EQUAL( powerSymbols, 14 );
86 const std::set<wxString> expectedConnectors{
"J1",
"J2" };
96 m_schematic->ConnectionGraph()->RunERC();
110 "Expected " <<
test.second <<
" errors in " <<
test.first.ToStdString()
111 <<
" but got " << errors.
GetCount() <<
"\n"
124 using DIAGNOSTIC = std::tuple<int, KIID, KIID, KIID_PATH>;
126 const std::vector<std::pair<wxString, CHECK>> cases = {
132 for(
const auto& [fixture, check] : cases )
138 for(
bool published : {
false,
true } )
143 m_schematic->RebuildConnectivity();
146 m_schematic->ConnectionGraph()->Reset();
152 std::multiset<DIAGNOSTIC>
actual;
154 for(
size_t i = 0; i < errors.
GetCount(); ++i )
156 const auto item = std::static_pointer_cast<ERC_ITEM>( errors.
GetItem( i ) );
157 actual.emplace( item->GetErrorCode(), item->GetMainItemID(), item->GetAuxItemID(),
158 item->IsSheetSpecific() ? item->GetSpecificSheetPath().Path() :
KIID_PATH() );
170 "Published diagnostics: " <<
actual.size() <<
", legacy: " <<
expected.size()
185 for(
bool published : {
false,
true } )
193 std::vector<SCH_PIN*> pins;
194 std::vector<SCH_ITEM*> flags;
199 pins.push_back(
pin );
203 flags.push_back( item );
205 BOOST_REQUIRE_EQUAL( pins.size(), 1 );
206 BOOST_REQUIRE_EQUAL( flags.size(), 1 );
209 for(
bool flagged : {
true,
false } )
214 m_schematic->RebuildConnectivity();
217 m_schematic->ConnectionGraph()->Reset();
223 BOOST_REQUIRE_EQUAL( errors.
GetCount(), flagged ? 0 : 1 );
245 auto* candidate =
static_cast<SCH_SYMBOL*
>( item );
247 if( candidate->GetRef( &
path ) == wxS(
"U1" ) )
253 BOOST_REQUIRE_EQUAL( pins.size(), 2 );
254 pins[1]->SetNumber( pins[0]->GetNumber() );
256 for(
bool backend : {
false,
true } )
258 for(
bool jumpered : {
false,
true } )
264 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
std::unique_ptr< SCHEMATIC > m_schematic
SETTINGS_MANAGER m_settingsManager
ERC_REGRESSION_TEST_FIXTURE()
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")