51 std::vector<DRC_ITEM> violations;
54 std::vector<wxString> allClasses{
"ANY",
"CAP_1",
"CAP_2",
"CLASS_1",
55 "CLASS_2",
"CLASS_3",
"CLASS_4",
"MULTI_REF",
56 "REF_WILDCARD",
"REF_WILDCARD2",
"RES_1",
"RES_2",
59 auto testClasses = [&allClasses](
const wxString& ref,
const COMPONENT_CLASS* compClass, std::vector<wxString> assignedClasses)
61 std::vector<wxString> unassignedClasses;
62 std::ranges::set_difference(allClasses, assignedClasses, std::back_inserter(unassignedClasses));
64 for(
const wxString& className : assignedClasses )
66 if( !compClass->ContainsClassName( className ) )
68 BOOST_ERROR( wxString::Format(
69 "%s component class failed (%s expected but not found - full class %s)",
70 ref, className, compClass->GetName() ) );
74 for(
const wxString& className : unassignedClasses )
76 if( compClass->ContainsClassName( className ) )
78 BOOST_ERROR( wxString::Format(
79 "%s component class failed (%s found but not expected - full class %s)",
80 ref, className, compClass->GetName() ) );
85 for(
const auto fp : m_board->Footprints() )
87 if( fp->Reference().GetText() == wxT(
"C1" ) )
89 testClasses(
"C1", fp->GetComponentClass(), {
"CAP_1",
"CLASS_3",
"CLASS_4"});
92 if( fp->Reference().GetText() == wxT(
"C2" ) )
94 testClasses(
"C2", fp->GetComponentClass(), {
"CAP_2",
"CLASS_3"});
97 if( fp->Reference().GetText() == wxT(
"C3" ) )
99 testClasses(
"C2", fp->GetComponentClass(), {});
102 if( fp->Reference().GetText() == wxT(
"R8" ) )
104 testClasses(
"R8", fp->GetComponentClass(), {
"RES_1",
"RES_2"});
107 if( fp->Reference().GetText() == wxT(
"R88" ) )
109 testClasses(
"R88", fp->GetComponentClass(), {
"RES_2"});
112 if( fp->Reference().GetText() == wxT(
"R2" ) )
114 testClasses(
"R2", fp->GetComponentClass(), {
"CLASS_1",
"RES_1",
"RES_2",
"RES_3"});
117 if( fp->Reference().GetText() == wxT(
"R1" ) )
119 testClasses(
"R1", fp->GetComponentClass(), {
"CLASS_1",
"CLASS_2",
"RES_1",
"RES_2",
"RES_4"});
122 if( fp->Reference().GetText() == wxT(
"U1" ) )
124 testClasses(
"U1", fp->GetComponentClass(), {
"ANY" } );
127 if( fp->Reference().GetText() == wxT(
"U2" ) )
129 testClasses(
"U2", fp->GetComponentClass(), {
"ANY" } );
132 if( fp->Reference().GetText() == wxT(
"U3" ) )
134 testClasses(
"U3", fp->GetComponentClass(), {
"MULTI_REF" } );
137 if( fp->Reference().GetText() == wxT(
"U4" ) )
139 testClasses(
"U4", fp->GetComponentClass(), {
"MULTI_REF" } );
142 if( fp->Reference().GetText() == wxT(
"U55" ) )
144 testClasses(
"U55", fp->GetComponentClass(), {
"REF_WILDCARD",
"REF_WILDCARD2" } );
147 if( fp->Reference().GetText() == wxT(
"U555" ) )
149 testClasses(
"U555", fp->GetComponentClass(), {
"REF_WILDCARD2" } );
152 if( fp->Reference().GetText() == wxT(
"R3" ) )
154 testClasses(
"R3", fp->GetComponentClass(), {
"/SHEET1/",
"RES_1",
"RES_2" } );