1#include <boost/test/unit_test.hpp>
32 m_schematic->ConnectionGraph()->Recalculate( m_schematic->BuildSheetListSortedByPageNumbers(),
true );
37 for(
const auto& pot : graph->GetPotentialSignals() )
40 wxString
name = wxString::Format( wxS(
"ERC_SIG_%d"), idx++ );
41 graph->CreateSignalFromPotential( pot.get(),
name );
44 m_schematic->ConnectionGraph()->RunERC();
54 const int expectedMismatches = 3;
56 int mismatchCount = 0;
57 for(
size_t i = 0; i < provider.
GetCount(); ++i )
59 auto item = provider.
GetItem( i );
67 if( mismatchCount != expectedMismatches )
70 auto* graph = m_schematic->ConnectionGraph();
72 graph->Recalculate( m_schematic->BuildSheetListSortedByPageNumbers(),
true );
73 const auto& signals = graph->GetSignals();
74 std::ostringstream oss;
75 oss <<
"DEBUG Pin-to-Pin mismatch failure: expected=" << expectedMismatches
76 <<
" got=" << mismatchCount <<
" totalItems=" << provider.
GetCount()
77 <<
" signals=" << signals.size() <<
"\n";
78 for(
size_t si = 0; si < signals.size(); ++si )
80 const auto& sig = signals[si];
82 oss <<
" Signal[" << si <<
"] name='" << sig->GetName() <<
"' nets={";
83 for(
const auto& n : sig->GetNets() ) oss << n <<
",";
86 for(
const auto& n : sig->GetNets() )
88 const auto& subgraphs = graph->GetAllSubgraphs( n );
91 for(
SCH_ITEM* item : sg->GetItems() )
104 oss <<
"All ERC item codes (severity filtered): ";
105 for(
size_t i = 0; i < provider.
GetCount(); ++i )
107 auto it = provider.
GetItem( i );
109 oss << (int) it->GetErrorCode() <<
",";
113 BOOST_CHECK_MESSAGE( mismatchCount == expectedMismatches,
117 BOOST_CHECK_MESSAGE( mismatchCount == expectedMismatches,
118 "Expected 3 pin-to-pin mismatch errors but got " << mismatchCount
131 m_schematic->ConnectionGraph()->Recalculate( m_schematic->BuildSheetListSortedByPageNumbers(),
true );
136 for(
const auto& pot : graph->GetPotentialSignals() )
139 wxString
name = wxString::Format( wxS(
"ERC_SIG_%d"), idx++ );
140 graph->CreateSignalFromPotential( pot.get(),
name );
143 m_schematic->ConnectionGraph()->RunERC();
152 int powerNotDriven = 0;
153 for(
size_t i = 0; i < provider.
GetCount(); ++i )
155 auto item = provider.
GetItem( i );
161 BOOST_CHECK_MESSAGE( powerNotDriven == 0,
"Expected no ERCE_POWERPIN_NOT_DRIVEN errors due to cross-signal driver; got " << powerNotDriven <<
"\n" << reportWriter.
GetTextReport() );
Calculate the connectivity of a schematic and generates netlists.
A subgraph is a set of items that are electrically connected on a single sheet.
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.
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,...
const SYMBOL * GetParentSymbol() const
const wxString & GetNumber() const
ELECTRICAL_PINTYPE GetType() 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.
virtual const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const =0
@ ERCE_POWERPIN_NOT_DRIVEN
Power input pin connected to some others pins but no power out pin to drive it.
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_PIN_TO_PIN_WARNING
@ 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_SIGNAL_TEST_FIXTURE()
SETTINGS_MANAGER m_settingsManager
std::unique_ptr< SCHEMATIC > m_schematic
BOOST_FIXTURE_TEST_CASE(BoardTypes, PROTO_TEST_FIXTURE)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_FIXTURE_TEST_CASE(ERCSignalPinToPin, ERC_SIGNAL_TEST_FIXTURE)
BOOST_AUTO_TEST_SUITE_END()