35struct CONNECTIVITY_TEST_FIXTURE
37 CONNECTIVITY_TEST_FIXTURE()
40 SETTINGS_MANAGER m_settingsManager;
41 std::unique_ptr<SCHEMATIC> m_schematic;
49 std::vector<std::pair<wxString, int>> tests =
51 {
"issue18092/issue18092", 1 }
54 for(
auto&[
name, nets] : tests )
58 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
61 BOOST_CHECK( nets == graph->
GetNetMap().size() );
84 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
90 std::map<wxString, int> tpNetCodes;
92 for(
const auto& [key, subgraphs] : graph->
GetNetMap() )
96 for(
SCH_ITEM* item : subgraph->GetItems() )
105 wxString ref = symbol->
GetRef( &subgraph->GetSheet() );
107 if( ref ==
"TP101" || ref ==
"TP102" ||
108 ref ==
"TP401" || ref ==
"TP402" )
110 tpNetCodes[ref] = key.Netcode;
119 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP101" ),
120 "TP101 should be found in netlist" );
121 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP102" ),
122 "TP102 should be found in netlist" );
123 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP401" ),
124 "TP401 should be found in netlist" );
125 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP402" ),
126 "TP402 should be found in netlist" );
129 BOOST_CHECK_MESSAGE( tpNetCodes[
"TP101"] == tpNetCodes[
"TP401"],
130 "TP101 and TP401 should be on the same net (m.X.Y.Z1)" );
134 BOOST_CHECK_MESSAGE( tpNetCodes[
"TP102"] == tpNetCodes[
"TP402"],
135 "TP102 and TP402 should be on the same net (m.X.Y.Z2)" );
150 SCH_SHEET_PATH sheet = m_schematic->BuildSheetListSortedByPageNumbers().
at( 0 );
153 std::vector<SCH_CONNECTION*> wireConns;
158 wireConns.push_back( item->Connection( &sheet ) );
161 BOOST_REQUIRE_EQUAL( wireConns.size(), 2 );
165 BOOST_CHECK_NE( wireConns[0]->Name(), wireConns[1]->Name() );
168 std::vector<wxString> expectedNames;
172 unsigned serial = (unsigned) ( item->m_Uuid.Hash() & 0xFFFFFFFF );
173 expectedNames.push_back( wxString::Format( wxS(
"Net-(TP?-%08x-Pad1)" ), serial ) );
176 BOOST_REQUIRE_EQUAL( expectedNames.size(), 4 );
180 bool found = std::find( expectedNames.begin(), expectedNames.end(), conn->Name() ) != expectedNames.end();
182 BOOST_CHECK_MESSAGE( found,
"Unexpected net name: " + conn->Name().ToStdString() );
Calculate the connectivity of a schematic and generate netlists.
const NET_MAP & GetNetMap() const
A subgraph is a set of items that are electrically connected on a single sheet.
EE_TYPE OfType(KICAD_T aType) const
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Base class for any item which can be embedded within the SCHEMATIC container class,...
EE_RTREE & Items()
Get the full RTree, usually for iterating.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
SCH_SHEET * at(size_t aIndex) const
Forwarded method from std::vector.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
std::vector< FAB_LAYER_COLOR > dummy
BOOST_FIXTURE_TEST_CASE(CheckNetCounts, CONNECTIVITY_TEST_FIXTURE)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())