55 size_t siblingChecks = 0;
57 size_t knownNetChecks = 0;
59 for(
const wxString& fixture : { wxString(
"netlists/multinetclasses/multinetclasses" ),
60 wxString(
"netlists/video/video" ),
61 wxString(
"spice_netlists/multiunit_repeat_opamp/multiunit_repeat_opamp" ) } )
64 std::unique_ptr<SCHEMATIC> schematic;
66 schematic->ConnectionGraph()->Reset();
67 schematic->Connectivity().Recalculate( *schematic,
true );
68 const auto& netSettings = schematic->Project().GetProjectFile().NetSettings();
70 std::map<wxString, std::vector<std::pair<SCH_SYMBOL*, SCH_SHEET_PATH>>> units;
76 auto* symbol =
static_cast<SCH_SYMBOL*
>( item );
77 units[symbol->GetRef( &
path )].emplace_back( symbol,
path );
85 auto* symbol =
static_cast<SCH_SYMBOL*
>( item );
92 const auto connection = schematic->Connectivity().Connection(
pin->m_Uuid,
path.Path() );
94 wxString localName = connection->LocalName();
96 if( localName.Lower().StartsWith(
"unconnected" ) )
102 for(
const auto& [function,
expected] :
103 { std::pair{ wxString(
"NET_NAME" ), connection->Name() },
104 std::pair{ wxString(
"SHORT_NET_NAME" ), localName },
105 std::pair{ wxString(
"NET_CLASS" ),
106 netSettings->GetEffectiveNetClass( connection->Name() )->GetName() } } )
108 wxString token = function +
"(" +
pin->GetNumber() +
")";
114 for(
const auto& [sibling, siblingPath] : units.at( symbol->GetRef( &
path ) ) )
116 if( sibling->GetUnitSelection( &siblingPath )
117 == symbol->GetUnitSelection( &
path ) )
120 const auto siblingPins = sibling->GetPins( &siblingPath );
122 if( std::any_of( siblingPins.begin(), siblingPins.end(),
123 [&](
const SCH_PIN* candidate )
124 { return candidate->GetNumber() == pin->GetNumber(); } ) )
127 wxString siblingToken = function +
"(" +
pin->GetNumber() +
")";
128 BOOST_REQUIRE( sibling->ResolveTextVar( &siblingPath, &siblingToken, 0 ) );
135 if( fixture ==
"netlists/multinetclasses/multinetclasses"
136 && symbol->GetRef( &
path ) ==
"R8" &&
pin->GetNumber() ==
"1" )
138 for(
const auto& [source,
expected] :
139 { std::pair{ wxString(
"NET_NAME(1)" ), wxString(
"/NET_2" ) },
140 std::pair{ wxString(
"SHORT_NET_NAME(1)" ), wxString(
"NET_2" ) },
141 std::pair{ wxString(
"NET_CLASS(1)" ), wxString(
"CLASS_COMPLETE" ) } } )
143 wxString token = source;
149 std::vector<MSG_PANEL_ITEM>
info;
153 using ROWS = std::vector<std::pair<wxString, wxString>>;
156 for(
const auto& row :
info )
158 if( row.GetUpperText() !=
"Subgraph Code" && row.GetUpperText() !=
"Connection Source" )
159 rows.emplace_back( row.GetUpperText(), row.GetLowerText() );
162 const ROWS expectedRows{ {
"Connection Name",
"/NET_2" },
163 {
"Resolved Netclass",
"CLASS_COMPLETE" } };
164 BOOST_CHECK( rows == expectedRows );
173 if( fixture ==
"netlists/multinetclasses/multinetclasses" )
175 size_t labelChecks = 0;
181 auto* label =
static_cast<SCH_LABEL*
>( item );
183 if( label->GetText() !=
"NET_2" )
189 for(
const auto& [source,
expected] :
190 { std::pair{ wxString(
"NET_NAME" ), wxString(
"/NET_2" ) },
191 std::pair{ wxString(
"SHORT_NET_NAME" ), wxString(
"NET_2" ) },
192 std::pair{ wxString(
"NET_CLASS" ), wxString(
"CLASS_COMPLETE" ) } } )
194 wxString token = source;
206 BOOST_CHECK_GT( checked, 0u );
207 BOOST_CHECK( schematic->ConnectionGraph()->GetNetMap().empty() );
210 BOOST_CHECK_GT( siblingChecks, 0u );
211 BOOST_CHECK_GT( ncChecks, 0u );
221 std::unique_ptr<SCHEMATIC> schematic;
223 using ROWS = std::vector<std::pair<wxString, wxString>>;
232 std::vector<MSG_PANEL_ITEM>
info;
236 for(
const auto& row :
info )
238 const wxString& heading = row.GetUpperText();
240 if( heading !=
"Bus Code" && heading !=
"Subgraph Code" && heading !=
"Connection Source" )
241 rows.emplace_back( heading, row.GetLowerText() );
254 auto rows = panel( *item, &
path );
255 BOOST_REQUIRE_GT( rows.size(), 1u );
256 expected.push_back( { item,
path, std::move( rows ) } );
262 schematic->ConnectionGraph()->Reset();
264 schematic->Connectivity().Recalculate( *schematic,
true );
268 entry.item->Connection( &entry.path )->Reset();
269 BOOST_CHECK( panel( *entry.item, &entry.path ) == entry.rows );
270 schematic->SetCurrentSheet( entry.path );
271 BOOST_CHECK( panel( *entry.item,
nullptr ) == entry.rows );
280 std::unique_ptr<SCHEMATIC> schematic;
282 schematic->ConnectionGraph()->Reset();
284 schematic->Connectivity().Recalculate( *schematic,
true );
290 auto* label =
static_cast<SCH_LABEL*
>( item );
291 const wxString
text = label->GetText();
293 if(
text !=
"NET_2" &&
text !=
"BUS{SIGNAL A[0..2]}" )
297 search.
findString =
text ==
"NET_2" ? wxString(
"/NET_2" ) : wxString(
"/BUS.SIGNAL" );
299 BOOST_CHECK( !label->Matches( search, &
path ) );
301 BOOST_CHECK( label->Matches( search, &
path ) );
std::optional< wxString > AppendConnectionInfo(const SCH_ITEM &aItem, std::vector< MSG_PANEL_ITEM > &aList, const SCH_SHEET_PATH *aPath=nullptr)
Append connection details; return its name for a signal, or no value for a bus/missing row.
BOOST_AUTO_TEST_CASE(DerivedPinTokensUsePublishedConnectivity)
BOOST_CHECK_EQUAL(result, "25.4")