1#include <boost/test/unit_test.hpp>
33 m_schematic->ConnectionGraph()->Recalculate( m_schematic->BuildSheetListSortedByPageNumbers(),
true );
41 wxString
name = wxString::Format( wxS(
"ERC_SIG_%d"), idx++ );
45 m_schematic->ConnectionGraph()->RunERC();
55 const int expectedMismatches = 3;
57 int mismatchCount = 0;
58 for(
size_t i = 0; i < provider.
GetCount(); ++i )
60 auto item = provider.
GetItem( i );
68 if( mismatchCount != expectedMismatches )
71 auto* graph = m_schematic->ConnectionGraph();
73 graph->Recalculate( m_schematic->BuildSheetListSortedByPageNumbers(),
true );
74 const auto& netChains = graph->GetCommittedNetChains();
75 std::ostringstream oss;
76 oss <<
"DEBUG Pin-to-Pin mismatch failure: expected=" << expectedMismatches
77 <<
" got=" << mismatchCount <<
" totalItems=" << provider.
GetCount()
78 <<
" chains=" << netChains.size() <<
"\n";
79 for(
size_t si = 0; si < netChains.size(); ++si )
81 const auto& sig = netChains[si];
83 oss <<
" Signal[" << si <<
"] name='" << sig->GetName() <<
"' nets={";
84 for(
const auto& n : sig->GetNets() ) oss << n <<
",";
87 for(
const auto& n : sig->GetNets() )
89 const auto& subgraphs = graph->GetAllSubgraphs( n );
92 for(
SCH_ITEM* item : sg->GetItems() )
105 oss <<
"All ERC item codes (severity filtered): ";
106 for(
size_t i = 0; i < provider.
GetCount(); ++i )
108 auto it = provider.
GetItem( i );
110 oss << (int) it->GetErrorCode() <<
",";
119 "Expected 3 pin-to-pin mismatch errors but got " << mismatchCount
132 m_schematic->ConnectionGraph()->Recalculate( m_schematic->BuildSheetListSortedByPageNumbers(),
true );
140 wxString
name = wxString::Format( wxS(
"ERC_SIG_%d"), idx++ );
144 m_schematic->ConnectionGraph()->RunERC();
153 int powerNotDriven = 0;
154 for(
size_t i = 0; i < provider.
GetCount(); ++i )
156 auto item = provider.
GetItem( i );
162 BOOST_CHECK_MESSAGE( powerNotDriven == 0,
"Expected no ERCE_POWERPIN_NOT_DRIVEN errors due to cross-signal driver; got " << powerNotDriven <<
"\n" << reportWriter.
GetTextReport() );
197 m_schematic->ConnectionGraph()->Recalculate( m_schematic->BuildSheetListSortedByPageNumbers(),
209 wxString
name = wxString::Format( wxS(
"ERC_SIG_%d" ), idx++ );
214 m_schematic->ConnectionGraph()->RunERC();
223 int warningCount = 0;
225 for(
size_t i = 0; i < provider.
GetCount(); ++i )
227 auto item = provider.
GetItem( i );
241 "Expected ERCE_PIN_TO_PIN_ERROR markers to be reported when only"
242 " ERCE_PIN_TO_PIN_WARNING is silenced, but got "
243 << errorCount <<
"\n"
247 "Expected zero ERCE_PIN_TO_PIN_WARNING markers when warning is silenced,"
248 " got " << warningCount <<
"\n"
Calculate the connectivity of a schematic and generates netlists.
SCH_NETCHAIN * CreateNetChainFromPotential(SCH_NETCHAIN *aPotential, const wxString &aName)
Promote a potential net chain to an actual user net chain with the provided name.
const std::vector< std::unique_ptr< SCH_NETCHAIN > > & GetPotentialNetChains() const
Potential net chains are inferred groupings produced by RebuildNetChains() but not yet user-committed...
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.
bool IsTestEnabled(int aErrorCode) const
std::map< int, SEVERITY > m_ERCSeverities
void SetPinMapValue(int aFirstType, int aSecondType, PIN_ERROR aValue)
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(ServerStartsAndResponds, API_SERVER_E2E_FIXTURE)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_FIXTURE_TEST_CASE(ERCSignalPinToPin, ERC_SIGNAL_TEST_FIXTURE)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")