20#include <boost/test/unit_test.hpp>
38 BOOST_CHECK( a == b );
42 BOOST_CHECK( a != b );
46 BOOST_CHECK( a == b );
60 BOOST_CHECK( a != b );
64 BOOST_CHECK( a == b );
68 BOOST_CHECK( a != b );
72 BOOST_CHECK( a == b );
86 BOOST_CHECK( a != b );
87 BOOST_CHECK( b != a );
94 const wxString& aExpected )
101 if( resolved->GetName() == aExpected )
104 for(
NETCLASS* constituent : resolved->GetConstituentNetclasses() )
106 if( constituent && constituent->GetName() == aExpected )
121 std::shared_ptr<NETCLASS> highSpeed = std::make_shared<NETCLASS>( wxS(
"HighSpeed" ),
false );
122 std::map<wxString, std::shared_ptr<NETCLASS>> classes;
123 classes[wxS(
"HighSpeed" )] = highSpeed;
141 std::shared_ptr<NETCLASS> highSpeed = std::make_shared<NETCLASS>( wxS(
"HighSpeed" ),
false );
142 std::shared_ptr<NETCLASS> power = std::make_shared<NETCLASS>( wxS(
"Power" ),
false );
143 std::map<wxString, std::shared_ptr<NETCLASS>> classes;
144 classes[wxS(
"HighSpeed" )] = highSpeed;
145 classes[wxS(
"Power" )] = power;
187 std::shared_ptr<NETCLASS> highSpeed = std::make_shared<NETCLASS>( wxS(
"HighSpeed" ),
false );
188 std::shared_ptr<NETCLASS> power = std::make_shared<NETCLASS>( wxS(
"Power" ),
false );
189 std::map<wxString, std::shared_ptr<NETCLASS>> classes;
190 classes[wxS(
"HighSpeed" )] = highSpeed;
191 classes[wxS(
"Power" )] = power;
196 BOOST_CHECK( a == b );
200 BOOST_CHECK( a == b );
205 BOOST_CHECK( a == b );
209 BOOST_CHECK( a == b );
224 source.
SetNetChainClass( wxS(
"CHAIN_WITH_SPACES and: punctuation!" ), wxS(
"Power" ) );
233 nlohmann::json reparsed = nlohmann::json::parse( serialized );
245 static_cast<nlohmann::json&
>( reparsedInternals ) = reparsed;
251 BOOST_CHECK( sink.
GetNetChainClass( wxS(
"CHAIN_A" ) ) == wxS(
"Default" ) );
252 BOOST_CHECK( sink.
GetNetChainClass( wxS(
"CHAIN_B" ) ) == wxS(
"HighSpeed" ) );
253 BOOST_CHECK( sink.
GetNetChainClass( wxS(
"CHAIN_WITH_SPACES and: punctuation!" ) )
255 BOOST_CHECK( sink.
GetNetChainClass( wxS(
"Unicode_éèê" ) ) == wxS(
"RF_µwave" ) );
257 BOOST_CHECK( source == sink );
270 nlohmann::json reparsed = nlohmann::json::parse( serialized );
273 BOOST_CHECK( reparsed[
"net_chain_classes"].is_object() );
274 BOOST_CHECK( reparsed[
"net_chain_classes"].
empty() );
281 static_cast<nlohmann::json&
>( reparsedInternals ) = reparsed;
301 nlohmann::json reparsed = nlohmann::json::parse( source.
FormatAsString() );
304 BOOST_REQUIRE_EQUAL( reparsed[
"net_chain_classes"].size(), 1u );
307 reparsed[
"net_chain_classes"][
"EMPTY"] =
"";
312 static_cast<nlohmann::json&
>( reparsedInternals ) = reparsed;
void CloneFrom(const JSON_SETTINGS_INTERNALS &aOther)
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
const std::string FormatAsString()
JSON_SETTINGS_INTERNALS * Internals()
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
A collection of nets and the parameters used to route or test these nets.
NET_SETTINGS stores various net-related settings in a project context.
void ClearChainPatternAssignments()
Clears all chain-derived pattern assignments.
void SetNetChainClass(const wxString &aChain, const wxString &aClass)
Assign a net chain to a named class (used by inNetChainClass() DRC scope).
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const wxString &aNetName)
Fetches the effective (may be aggregate) netclass for the given net name.
wxString GetNetChainClass(const wxString &aChain) const
Look up the class assigned to a chain. Empty string means "no class".
void SetNetclasses(const std::map< wxString, std::shared_ptr< NETCLASS > > &netclasses)
Sets all netclass Calling this method will reset the effective netclass calculation caches.
void SetNetclassLabelAssignment(const wxString &netName, const std::set< wxString > &netclasses)
Sets a net name to netclasses assignment Calling user is responsible for resetting the effective netc...
void SetNetclassPatternAssignment(const wxString &pattern, const wxString &netclass)
Sets a netclass pattern assignment Calling this method will reset the effective netclass calculation ...
const std::map< wxString, wxString > & GetNetChainClasses() const
void SetChainPatternAssignment(const wxString &pattern, const wxString &netclass)
Sets a chain-derived netclass pattern assignment.
void ClearNetChainClasses()
Removes all chain-to-class assignments.
static bool empty(const wxTextEntryBase *aCtrl)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(ChainClassAssignmentAffectsEquality)
static bool resolvesToNetclass(NET_SETTINGS &aSettings, const wxString &aNetName, const wxString &aExpected)
BOOST_CHECK_EQUAL(result, "25.4")