97 std::map<wxString, std::map<wxString, PIN_NET>> symbolPins;
99 for(
const auto& [key, subgraphs] : graph->
GetNetMap() )
103 for(
SCH_ITEM* item : subgraph->GetItems() )
114 wxString ref = symbol->
GetRef( &subgraph->GetSheet() );
115 wxString pinNum =
pin->GetNumber();
117 symbolPins[ref][pinNum] = { key.Netcode, key.Name };
122 BOOST_REQUIRE_MESSAGE( symbolPins.count(
"J1" ),
123 "J1 connector should appear in the netlist" );
124 BOOST_REQUIRE_MESSAGE( symbolPins.count(
"TP1" ),
125 "TP1 testpoint should appear in the netlist" );
127 const auto& j1Pins = symbolPins[
"J1"];
128 const auto& tp1Pins = symbolPins[
"TP1"];
132 BOOST_REQUIRE_MESSAGE( j1Pins.size() >= 2,
133 wxString::Format(
"J1 should have >= 2 connected pins, found %zu",
134 j1Pins.size() ).ToStdString() );
137 BOOST_REQUIRE_MESSAGE( tp1Pins.size() == 1,
138 wxString::Format(
"TP1 should have exactly 1 connected pin, found %zu",
139 tp1Pins.size() ).ToStdString() );
141 const auto& tp1Pin = *tp1Pins.begin();
142 const auto& j1PinA = *j1Pins.begin();
143 const auto& j1PinB = *std::next( j1Pins.begin() );
146 [](
const wxString& aRefA,
const auto& aPinA,
const wxString& aRefB,
const auto& aPinB )
148 return wxString::Format(
149 "%s-%s (%s, code=%d) and %s-%s (%s, code=%d) should share a net",
150 aRefA, aPinA.first, aPinA.second.name, aPinA.second.code,
151 aRefB, aPinB.first, aPinB.second.name, aPinB.second.code )
156 sameNetMsg(
"J1", j1PinA,
"TP1", tp1Pin ) );
159 sameNetMsg(
"J1", j1PinB,
"TP1", tp1Pin ) );
162 sameNetMsg(
"J1", j1PinA,
"J1", j1PinB ) );