46 std::vector<std::pair<wxString, int>> tests =
48 {
"issue18092/issue18092", 1 }
51 for(
auto&[
name, nets] : tests )
55 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
58 BOOST_CHECK( nets == graph->
GetNetMap().size() );
81 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
87 std::map<wxString, int> tpNetCodes;
89 for(
const auto& [key, subgraphs] : graph->
GetNetMap() )
93 for(
SCH_ITEM* item : subgraph->GetItems() )
102 wxString ref = symbol->
GetRef( &subgraph->GetSheet() );
104 if( ref ==
"TP101" || ref ==
"TP102" ||
105 ref ==
"TP401" || ref ==
"TP402" )
107 tpNetCodes[ref] = key.Netcode;
116 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP101" ),
117 "TP101 should be found in netlist" );
118 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP102" ),
119 "TP102 should be found in netlist" );
120 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP401" ),
121 "TP401 should be found in netlist" );
122 BOOST_REQUIRE_MESSAGE( tpNetCodes.count(
"TP402" ),
123 "TP402 should be found in netlist" );
126 BOOST_CHECK_MESSAGE( tpNetCodes[
"TP101"] == tpNetCodes[
"TP401"],
127 "TP101 and TP401 should be on the same net (m.X.Y.Z1)" );
131 BOOST_CHECK_MESSAGE( tpNetCodes[
"TP102"] == tpNetCodes[
"TP402"],
132 "TP102 and TP402 should be on the same net (m.X.Y.Z2)" );
147 SCH_SHEET_PATH sheet = m_schematic->BuildSheetListSortedByPageNumbers().
at( 0 );
150 std::vector<SCH_CONNECTION*> wireConns;
155 wireConns.push_back( item->Connection( &sheet ) );
158 BOOST_REQUIRE_EQUAL( wireConns.size(), 2 );
162 BOOST_CHECK_NE( wireConns[0]->Name(), wireConns[1]->Name() );
165 std::vector<wxString> expectedNames;
169 unsigned serial = (unsigned) ( item->m_Uuid.Hash() & 0xFFFFFFFF );
170 expectedNames.push_back( wxString::Format( wxS(
"Net-(TP?-%08x-Pad1)" ), serial ) );
173 BOOST_REQUIRE_EQUAL( expectedNames.size(), 4 );
177 bool found = std::find( expectedNames.begin(), expectedNames.end(), conn->Name() ) != expectedNames.end();
179 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
SETTINGS_MANAGER m_settingsManager
CONNECTIVITY_TEST_FIXTURE()
std::unique_ptr< SCHEMATIC > m_schematic
BOOST_FIXTURE_TEST_CASE(CheckNetCounts, CONNECTIVITY_TEST_FIXTURE)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())