93 std::map<wxString, std::map<wxString, PIN_NET>> symbolPins;
95 for(
const auto& [key, subgraphs] : graph->
GetNetMap() )
99 for(
SCH_ITEM* item : subgraph->GetItems() )
110 wxString ref = symbol->
GetRef( &subgraph->GetSheet() );
111 wxString pinNum =
pin->GetNumber();
113 symbolPins[ref][pinNum] = { key.Netcode, key.Name };
118 BOOST_REQUIRE_MESSAGE( symbolPins.count(
"J1" ),
119 "J1 connector should appear in the netlist" );
120 BOOST_REQUIRE_MESSAGE( symbolPins.count(
"TP1" ),
121 "TP1 testpoint should appear in the netlist" );
123 const auto& j1Pins = symbolPins[
"J1"];
124 const auto& tp1Pins = symbolPins[
"TP1"];
128 BOOST_REQUIRE_MESSAGE( j1Pins.size() >= 2,
129 wxString::Format(
"J1 should have >= 2 connected pins, found %zu",
130 j1Pins.size() ).ToStdString() );
133 BOOST_REQUIRE_MESSAGE( tp1Pins.size() == 1,
134 wxString::Format(
"TP1 should have exactly 1 connected pin, found %zu",
135 tp1Pins.size() ).ToStdString() );
137 const auto& tp1Pin = *tp1Pins.begin();
138 const auto& j1PinA = *j1Pins.begin();
139 const auto& j1PinB = *std::next( j1Pins.begin() );
142 [](
const wxString& aRefA,
const auto& aPinA,
const wxString& aRefB,
const auto& aPinB )
144 return wxString::Format(
145 "%s-%s (%s, code=%d) and %s-%s (%s, code=%d) should share a net",
146 aRefA, aPinA.first, aPinA.second.name, aPinA.second.code,
147 aRefB, aPinB.first, aPinB.second.name, aPinB.second.code )
152 sameNetMsg(
"J1", j1PinA,
"TP1", tp1Pin ) );
155 sameNetMsg(
"J1", j1PinB,
"TP1", tp1Pin ) );
158 sameNetMsg(
"J1", j1PinA,
"J1", j1PinB ) );