22#include <boost/test/data/test_case.hpp>
48 std::vector<PAD_CHECK_CODE> m_ExpectedCodes;
52const std::vector<PAD_CHECK_TEST_CASE> padCheckCases = {
58 PAD_CHECK_CODE::PAD_NO_OUTER_COPPER,
59 PAD_CHECK_CODE::MULTIPLE_COPPER_LAYERS,
63 "inner-only CONN pad",
66 { PAD_CHECK_CODE::PAD_NO_OUTER_COPPER },
70 "inner-only SMD pad with front mask",
73 { PAD_CHECK_CODE::PAD_NO_OUTER_COPPER },
77 "inner-only SMD pad with back paste",
80 { PAD_CHECK_CODE::PAD_NO_OUTER_COPPER },
83 "aperture pad with paste",
89 "outer and inner SMD pad",
92 { PAD_CHECK_CODE::MULTIPLE_COPPER_LAYERS },
95 "both outer copper sides",
98 { PAD_CHECK_CODE::MULTIPLE_COPPER_LAYERS },
104 { PAD_CHECK_CODE::MASK_WRONG_SIDE },
107 "non-component front pad",
113 "non-component inner pad",
119 "non-component inner pad with front mask",
122 { PAD_CHECK_CODE::NON_COMPONENT_TECH_ON_INNER },
125 "non-component multiple copper layers",
128 { PAD_CHECK_CODE::MULTIPLE_COPPER_LAYERS },
131 "non-component no copper",
134 { PAD_CHECK_CODE::NON_COMPONENT_NO_COPPER },
139void checkPadResults(
const std::vector<PAD_UTILS::PAD_CHECK_RESULT>& aResults,
140 const std::vector<PAD_CHECK_CODE>& aExpectedCodes )
142 std::vector<int> actualCodes;
143 actualCodes.reserve( aResults.size() );
146 actualCodes.push_back(
static_cast<int>(
message.code ) );
148 std::vector<int> expectedCodes;
149 expectedCodes.reserve( aExpectedCodes.size() );
151 for( PAD_CHECK_CODE code : aExpectedCodes )
152 expectedCodes.push_back(
static_cast<int>( code ) );
154 std::sort( actualCodes.begin(), actualCodes.end() );
155 std::sort( expectedCodes.begin(), expectedCodes.end() );
193 m_Pad.SetAttribute( aAttrib );
194 m_Pad.SetLayerSet( aLayers );
205 std::vector<PAD_UTILS::PAD_CHECK_RESULT> messages;
207 const auto errorHandler =
210 messages.push_back( aResult );
227 setLayers( testCase.m_Attribute, testCase.m_Layers );
229 const auto messages = runPadCheckOnPad();
231 checkPadResults( messages, testCase.m_ExpectedCodes );
242 checkPadResults( runPadCheckOnPad(), { PAD_CHECK_CODE::UNEXPECTED_HOLE } );
251 checkPadResults( runPadCheckOnPad(), { PAD_CHECK_CODE::NON_COMPONENT_INNER_NEEDS_CUSTOM_STACKUP } );
constexpr EDA_IU_SCALE pcbIUScale
Information pertinent to a Pcbnew printed circuit board.
LSET is a set of PCB_LAYER_IDs.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
@ NORMAL
Shape is the same on all layers.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
void CheckPad(const PAD &aPad, const UNITS_PROVIDER &aUnitsProvider, bool aForPadProperties, const PAD_CHECK_HANDLER &aErrorHandler)
Run non-board-specific checks on a pad.
PAD_CHECK_CODE
A specific pad check finding reason.
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
@ NON_COMPONENT
Pad with no hole that does not connect to a physical component, but rather provides a connection poin...
@ SMD
Smd pad, appears on the solder paste layer (default)
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
A named data-driven test case.
Fixture for pad check tests: This sets up a board, footprint, and pad, and provides utility functions...
std::vector< PAD_UTILS::PAD_CHECK_RESULT > runPadCheckOnPad()
Runs the pad check on the current pad and returns the results.
void setLayers(PAD_ATTRIB aAttrib, const LSET &aLayers)
A single finding from CheckPad().
BOOST_FIXTURE_TEST_CASE(ServerStartsAndResponds, API_SERVER_E2E_FIXTURE)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_DATA_TEST_CASE_F(CONNECTIVITY_DUMP_FIXTURE, LegacyAndEngineDumpsMatch, boost::unit_test::data::make(PARITY_FIXTURES), fixture)
BOOST_CHECK_EQUAL_COLLECTIONS(mixed.begin(), mixed.end(), expMixed.begin(), expMixed.end())
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_CONTEXT("Test Clearance")
VECTOR2< int32_t > VECTOR2I