50 std::vector<wxString> collected;
55 [&](
const wxString& member )
57 collected.push_back( member );
60 std::vector<wxString>
expected = { wxS(
"DATA0" ), wxS(
"DATA1" ), wxS(
"DATA2" ),
63 BOOST_CHECK_EQUAL_COLLECTIONS( collected.begin(), collected.end(),
expected.begin(),
69 [&](
const wxString& member )
71 collected.push_back( member );
74 expected = { wxS(
"A0" ), wxS(
"A1" ), wxS(
"B2" ), wxS(
"B3" ) };
75 BOOST_CHECK_EQUAL_COLLECTIONS( collected.begin(), collected.end(),
expected.begin(),
81 [&](
const wxString& member )
83 collected.push_back( member );
87 BOOST_CHECK_EQUAL_COLLECTIONS( collected.begin(), collected.end(),
expected.begin(),
98 std::vector<wxString> members;
105 std::vector<wxString>
expected = { wxS(
"IN0" ), wxS(
"IN1" ), wxS(
"IN2" ), wxS(
"IN3" ),
106 wxS(
"IN4" ), wxS(
"IN5" ), wxS(
"IN6" ), wxS(
"IN7" ) };
108 BOOST_CHECK_EQUAL_COLLECTIONS( members.begin(), members.end(),
expected.begin(),
expected.end() );
128 std::shared_ptr<NET_SETTINGS>& netSettings =
129 m_schematic->Project().GetProjectFile().m_NetSettings;
137 for(
int i = 0; i <= 7; i++ )
139 wxString netName = wxString::Format(
"/IN%d", i );
140 std::shared_ptr<NETCLASS> nc = netSettings->GetEffectiveNetClass( netName );
147 for(
int i = 0; i <= 7; i++ )
149 wxString netName = wxString::Format(
"/OUT%d", i );
150 std::shared_ptr<NETCLASS> nc = netSettings->GetEffectiveNetClass( netName );
168 std::shared_ptr<NET_SETTINGS>& netSettings =
169 m_schematic->Project().GetProjectFile().m_NetSettings;
172 std::shared_ptr<NETCLASS> inputNc = netSettings->GetEffectiveNetClass(
"/IN0" );
181 std::shared_ptr<NETCLASS> outputNc = netSettings->GetEffectiveNetClass(
"/OUT0" );
186 BOOST_CHECK_CLOSE( outputColor.
g, 0.6, 1.0 );
202 std::shared_ptr<NET_SETTINGS>& netSettings =
203 m_schematic->Project().GetProjectFile().m_NetSettings;
207 std::shared_ptr<NETCLASS> busNc = netSettings->GetEffectiveNetClass(
"/IN[0..7]" );
217 busNc = netSettings->GetEffectiveNetClass(
"/OUT[7..0]" );
221 busColor = busNc->GetSchematicColor();
223 BOOST_CHECK_CLOSE( busColor.
g, 0.6, 1.0 );
238 std::shared_ptr<NET_SETTINGS>& netSettings =
239 m_schematic->Project().GetProjectFile().m_NetSettings;
242 netSettings->SetNetclassPatternAssignment( wxS(
"PCI{North[0..2] South[3..5]}" ),
247 for(
int i = 0; i <= 2; i++ )
249 wxString netName = wxString::Format(
"North%d", i );
250 std::shared_ptr<NETCLASS> nc = netSettings->GetEffectiveNetClass( netName );
257 for(
int i = 3; i <= 5; i++ )
259 wxString netName = wxString::Format(
"South%d", i );
260 std::shared_ptr<NETCLASS> nc = netSettings->GetEffectiveNetClass( netName );
277 std::shared_ptr<NET_SETTINGS>& netSettings =
278 m_schematic->Project().GetProjectFile().m_NetSettings;
281 netSettings->SetNetclassPatternAssignment( wxS(
"MIXED0" ), wxS(
"Input" ) );
282 netSettings->SetNetclassPatternAssignment( wxS(
"MIXED1" ), wxS(
"Output" ) );
286 std::shared_ptr<NETCLASS> busNc = netSettings->GetEffectiveNetClass(
"MIXED[0..1]" );
300 std::shared_ptr<NET_SETTINGS>& netSettings =
301 m_schematic->Project().GetProjectFile().m_NetSettings;
304 netSettings->SetNetclassPatternAssignment( wxS(
"/TEST*" ), wxS(
"Input" ) );
307 std::shared_ptr<NETCLASS> nc = netSettings->GetEffectiveNetClass(
"/TEST_NET" );
310 nc = netSettings->GetEffectiveNetClass(
"/TESTXYZ" );
326 std::shared_ptr<NET_SETTINGS>& netSettings =
327 m_schematic->Project().GetProjectFile().m_NetSettings;
330 std::shared_ptr<NETCLASS> nc = netSettings->GetEffectiveNetClass(
"/IN0" );
334 BOOST_CHECK( netSettings->HasEffectiveNetClass(
"/IN0" ) );
337 netSettings->ClearCacheForNet(
"/IN0" );
340 BOOST_CHECK( !netSettings->HasEffectiveNetClass(
"/IN0" ) );
343 nc = netSettings->GetEffectiveNetClass(
"/IN0" );
348 netSettings->SetNetclassPatternAssignment( wxS(
"/OLD_NET" ), wxS(
"Input" ) );
349 netSettings->SetNetclassPatternAssignment( wxS(
"/NEW_NET" ), wxS(
"Output" ) );
352 nc = netSettings->GetEffectiveNetClass(
"/OLD_NET" );
355 nc = netSettings->GetEffectiveNetClass(
"/NEW_NET" );
359 netSettings->ClearAllCaches();
362 nc = netSettings->GetEffectiveNetClass(
"/OLD_NET" );
365 nc = netSettings->GetEffectiveNetClass(
"/NEW_NET" );
A color representation with 4 components: red, green, blue, alpha.
A generic fixture for loading schematics and associated settings for qa tests.
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parse a bus vector (e.g.
static void ForEachBusMember(const wxString &aBusPattern, const std::function< void(const wxString &)> &aFunction)
Call a function for each member of an expanded bus pattern.
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(ForEachBusMemberExpansion)
Test that ForEachBusMember correctly expands bus patterns.
BOOST_TEST_INFO("Parsed: "<< path)
VECTOR3I expected(15, 30, 45)
BOOST_CHECK_EQUAL(result, "25.4")