130 const char* corpus = std::getenv(
"KICAD_ORCAD_CORPUS" );
132 if( !corpus || !*corpus )
135 for(
const char* relativePath : {
"PADS/adi-eval/DC1366B/DC1366B-2.DSN",
136 "OrCAD/_zulip-dm/S-593487-REV-B.DSN" } )
138 std::filesystem::path source = std::filesystem::path( corpus ) / relativePath;
139 bool equivalentDrivers = source.filename() ==
"S-593487-REV-B.DSN";
141 if( !std::filesystem::exists( source ) )
143 BOOST_TEST_MESSAGE( source.filename().string() <<
" not present; skipping weak-driver reload check." );
148 m_settingsManager.LoadProject(
"" );
149 m_schematic = std::make_unique<SCHEMATIC>( &m_settingsManager.Prj() );
155 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
156 m_schematic->ConnectionGraph()->Recalculate( sheets,
true );
157 std::map<std::pair<wxString, wxString>, wxString> terminals;
164 wxString reference = symbol->
GetRef( &sheet,
false );
166 if( reference != wxS(
"J4" ) && reference != wxS(
"T2" )
167 && reference != wxS(
"T3" ) && reference != wxS(
"T4" ) && reference != wxS(
"U9" ) )
177 terminals[{ reference,
pin->GetNumber() }] = connection->
Name();
182 std::map<wxString, wxString>
result;
184 if( equivalentDrivers )
186 for(
const wxString& number : { wxString(
"3" ), wxString(
"5" ), wxString(
"10" ), wxString(
"12" ) } )
188 auto terminal = terminals.find( { wxS(
"U9" ), number } );
190 BOOST_CHECK( terminal->second.StartsWith( wxS(
"Net-(U9-IN+)" ) ) );
191 result[number] = terminal->second;
195 BOOST_CHECK_NE(
result.at( wxS(
"3" ) ),
result.at( wxS(
"5" ) ) );
196 BOOST_CHECK_NE(
result.at( wxS(
"3" ) ),
result.at( wxS(
"12" ) ) );
197 BOOST_CHECK_NE(
result.at( wxS(
"5" ) ),
result.at( wxS(
"12" ) ) );
201 for(
const auto& [number, transformer] :
202 { std::pair{ wxString(
"9" ), wxString(
"T2" ) },
203 std::pair{ wxString(
"17" ), wxString(
"T3" ) },
204 std::pair{ wxString(
"25" ), wxString(
"T4" ) } } )
206 auto connector = terminals.find( { wxS(
"J4" ), number } );
207 auto peer = terminals.find( { transformer, wxS(
"1" ) } );
211 BOOST_CHECK( connector->second.StartsWith( wxS(
"Net-(J4-1)" ) ) );
212 result[number] = connector->second;
215 std::set<wxString> distinct;
218 distinct.insert(
name );
224 auto before = names();
226 std::vector<wxString> files;
227 std::vector<std::pair<KIID, wxString>> identities;
229 for(
SCH_SHEET* sheet : m_schematic->GetTopLevelSheets() )
231 wxString file = wxFileName::CreateTempFileName( wxS(
"weak_net_reload_" ) );
233 files.push_back( file );
234 identities.emplace_back( sheet->m_Uuid, sheet->GetName() );
237 m_schematic->Reset();
238 std::vector<SCH_SHEET*> reloaded;
240 for(
size_t i = 0; i < files.size(); ++i )
244 const_cast<KIID&
>( sheet->
m_Uuid ) = identities[i].first;
245 sheet->
SetName( identities[i].second );
246 reloaded.push_back( sheet );
249 m_schematic->SetTopLevelSheets( reloaded );
250 m_schematic->RefreshHierarchy();
252 for(
const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
253 sheet.LastScreen()->UpdateLocalLibSymbolLinks();
255 auto after = names();
257 for(
const auto& [number,
name] : before )
260 for(
const wxString& file : files )
261 wxRemoveFile( file );
void SaveSchematicFile(const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aSchematic to a storage file in a format that this SCH_IO implementation knows about,...
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
BOOST_FIXTURE_TEST_CASE(ShortedBusNetsHaveDeterministicName, BUS_NET_NAME_DETERMINISM_FIXTURE)
Test that when bus member nets (A0, A1, A2, A3) are shorted together, the resulting net name is deter...
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")