48 std::vector<DRC_ITEM> violations;
51 std::vector<wxString> allClasses{
"ANY",
"CAP_1",
"CAP_2",
"CLASS_1",
52 "CLASS_2",
"CLASS_3",
"CLASS_4",
"MULTI_REF",
53 "REF_WILDCARD",
"REF_WILDCARD2",
"RES_1",
"RES_2",
56 auto testClasses = [&allClasses](
const wxString& ref,
const COMPONENT_CLASS* compClass, std::vector<wxString> assignedClasses)
58 std::vector<wxString> unassignedClasses;
59 std::ranges::set_difference(allClasses, assignedClasses, std::back_inserter(unassignedClasses));
61 for(
const wxString& className : assignedClasses )
63 if( !compClass->ContainsClassName( className ) )
65 BOOST_ERROR( wxString::Format(
66 "%s component class failed (%s expected but not found - full class %s)",
67 ref, className, compClass->GetName() ) );
71 for(
const wxString& className : unassignedClasses )
73 if( compClass->ContainsClassName( className ) )
75 BOOST_ERROR( wxString::Format(
76 "%s component class failed (%s found but not expected - full class %s)",
77 ref, className, compClass->GetName() ) );
82 for(
const auto fp : m_board->Footprints() )
84 if( fp->Reference().GetText() == wxT(
"C1" ) )
86 testClasses(
"C1", fp->GetComponentClass(), {
"CAP_1",
"CLASS_3",
"CLASS_4"});
89 if( fp->Reference().GetText() == wxT(
"C2" ) )
91 testClasses(
"C2", fp->GetComponentClass(), {
"CAP_2",
"CLASS_3"});
94 if( fp->Reference().GetText() == wxT(
"C3" ) )
96 testClasses(
"C2", fp->GetComponentClass(), {});
99 if( fp->Reference().GetText() == wxT(
"R8" ) )
101 testClasses(
"R8", fp->GetComponentClass(), {
"RES_1",
"RES_2"});
104 if( fp->Reference().GetText() == wxT(
"R88" ) )
106 testClasses(
"R88", fp->GetComponentClass(), {
"RES_2"});
109 if( fp->Reference().GetText() == wxT(
"R2" ) )
111 testClasses(
"R2", fp->GetComponentClass(), {
"CLASS_1",
"RES_1",
"RES_2",
"RES_3"});
114 if( fp->Reference().GetText() == wxT(
"R1" ) )
116 testClasses(
"R1", fp->GetComponentClass(), {
"CLASS_1",
"CLASS_2",
"RES_1",
"RES_2",
"RES_4"});
119 if( fp->Reference().GetText() == wxT(
"U1" ) )
121 testClasses(
"U1", fp->GetComponentClass(), {
"ANY" } );
124 if( fp->Reference().GetText() == wxT(
"U2" ) )
126 testClasses(
"U2", fp->GetComponentClass(), {
"ANY" } );
129 if( fp->Reference().GetText() == wxT(
"U3" ) )
131 testClasses(
"U3", fp->GetComponentClass(), {
"MULTI_REF" } );
134 if( fp->Reference().GetText() == wxT(
"U4" ) )
136 testClasses(
"U4", fp->GetComponentClass(), {
"MULTI_REF" } );
139 if( fp->Reference().GetText() == wxT(
"U55" ) )
141 testClasses(
"U55", fp->GetComponentClass(), {
"REF_WILDCARD",
"REF_WILDCARD2" } );
144 if( fp->Reference().GetText() == wxT(
"U555" ) )
146 testClasses(
"U555", fp->GetComponentClass(), {
"REF_WILDCARD2" } );
149 if( fp->Reference().GetText() == wxT(
"R3" ) )
151 testClasses(
"R3", fp->GetComponentClass(), {
"/SHEET1/",
"RES_1",
"RES_2" } );