22#include <boost/test/data/test_case.hpp>
48 std::vector<PAD_CHECK_CODE> m_ExpectedCodes;
52const std::vector<PAD_CHECK_TEST_CASE> padCheckCases = {
57 { PAD_CHECK_CODE::PAD_NO_OUTER_COPPER },
60 "inner-only CONN pad",
63 { PAD_CHECK_CODE::PAD_NO_OUTER_COPPER },
67 "inner-only SMD pad with front mask",
70 { PAD_CHECK_CODE::PAD_NO_OUTER_COPPER },
74 "inner-only SMD pad with back paste",
77 { PAD_CHECK_CODE::PAD_NO_OUTER_COPPER },
80 "aperture pad with paste",
86 "outer and inner SMD pad",
92 "both outer copper sides",
95 { PAD_CHECK_CODE::SMD_BOTH_OUTER_SIDES },
101 { PAD_CHECK_CODE::SMD_MASK_WRONG_SIDE },
106void checkPadResults(
const std::vector<PAD_UTILS::PAD_CHECK_RESULT>& aResults,
107 const std::vector<PAD_CHECK_CODE>& aExpectedCodes )
109 std::vector<int> actualCodes;
110 actualCodes.reserve( aResults.size() );
113 actualCodes.push_back(
static_cast<int>(
message.code ) );
115 std::vector<int> expectedCodes;
116 expectedCodes.reserve( aExpectedCodes.size() );
118 for( PAD_CHECK_CODE code : aExpectedCodes )
119 expectedCodes.push_back(
static_cast<int>( code ) );
121 std::sort( actualCodes.begin(), actualCodes.end() );
122 std::sort( expectedCodes.begin(), expectedCodes.end() );
156 m_Pad.SetAttribute( aAttrib );
157 m_Pad.SetLayerSet( aLayers );
168 std::vector<PAD_UTILS::PAD_CHECK_RESULT> messages;
170 const auto errorHandler =
173 messages.push_back( aResult );
190 setLayers( testCase.m_Attribute, testCase.m_Layers );
192 const auto messages = runPadCheckOnPad();
194 checkPadResults( messages, testCase.m_ExpectedCodes );
constexpr EDA_IU_SCALE pcbIUScale
Information pertinent to a Pcbnew printed circuit board.
LSET is a set of 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().
@ 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_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