|
KiCad PCB EDA Suite
|
Classes | |
| class | ALLEGRO_CACHED_LOADER |
| Singleton class to load Allegro boards and cache them in memory, to avoid repeatedly loading and parsing the same board files for multiple tests. More... | |
| struct | BLK_TEST_INFO |
| A single block of test data, along with the expected result of parsing it. More... | |
| class | BOARD_DUMPER |
| A helper that contains logic to assist in dumping boards to disk depending on some environment variables. More... | |
| class | BOARD_EXPECTATION |
| A single expectation about a board, which can be run as a test against a parsed BOARD. More... | |
| class | BOARD_EXPECTATION_TEST |
| struct | BOARD_LOAD_TEST_CASE |
| struct | BOARD_TEST_DEF |
| class | CACHED_BOARD_LOADER |
| Manager for caching loaded boards in memory, to avoid repeatedly loading and parsing the same board. More... | |
| class | CAPTURING_REPORTER |
| Custom REPORTER that captures all messages for later analysis in the unit test framework. More... | |
| class | COMBINED_UTILITY |
| Class that handles delegation of command lines to one of a number of "sub-utilities". More... | |
| struct | CommonTestData |
| Common data for some of the SHAPE_POLY_SET tests: More... | |
| class | CONSOLE_LOG |
| class | CONSOLE_MSG_REPORTER |
| class | DUMMY_TOOL |
| struct | HEADER_TEST_INFO |
| A header block, along with the expected result of parsing it. More... | |
| struct | kitest_cmp_drawings |
| struct | NAMED_CASE |
| A named data-driven test case. More... | |
| class | SCHEMATIC_TEST_FIXTURE |
| A generic fixture for loading schematics and associated settings for qa tests. More... | |
| class | TEMPORARY_DIRECTORY |
| A temporary directory that will be deleted when it goes out of scope. More... | |
| struct | UTILITY_PROGRAM |
| Description of a "utility program", which is a program that takes some command line and does "something". More... | |
| class | WX_ASSERT_ERROR |
| An exception class to represent a WX assertion. More... | |
Typedefs | |
| template<typename EXP_CONT> | |
| using | EXP_OBJ = typename EXP_CONT::value_type |
| template<typename FOUND_CONT> | |
| using | FOUND_OBJ = typename FOUND_CONT::value_type |
| template<typename EXP_OBJ, typename FOUND_OBJ> | |
| using | MATCH_PRED = std::function<bool( const EXP_OBJ&, const FOUND_OBJ& )> |
| A match predicate: check that a "found" object is equivalent to or represents an "expected" object, perhaps of a different type. | |
Enumerations | |
| enum | RET_CODES { OK = 0 , BAD_CMDLINE = 1 , UNKNOWN_TOOL = 2 , TOOL_SPECIFIC = 10 } |
| Return codes for tools. More... | |
Functions | |
| void | DrawSegment (FOOTPRINT &aFootprint, const SEG &aSeg, int aWidth, PCB_LAYER_ID aLayer) |
| Draw a segment in the given footprint. | |
| void | DrawPolyline (FOOTPRINT &aFootprint, const std::vector< VECTOR2I > &aPts, int aWidth, PCB_LAYER_ID aLayer) |
| Draw a polyline - a set of linked segments. | |
| void | DrawArc (FOOTPRINT &aFootprint, const VECTOR2I &aCentre, const VECTOR2I &aStart, const EDA_ANGLE &aAngle, int aWidth, PCB_LAYER_ID aLayer) |
| Draw an arc on a footprint. | |
| void | DrawRect (FOOTPRINT &aFootprint, const VECTOR2I &aPos, const VECTOR2I &aSize, int aRadius, int aWidth, PCB_LAYER_ID aLayer) |
| Draw a rectangle on a footprint. | |
| std::string | GetPcbnewTestDataDir () |
| Utility which returns a path to the data directory where the test board files are stored. | |
| void | DumpBoardToFile (BOARD &aBoard, const std::string &aFilename) |
| Utility function to simply write a Board out to a file. | |
| std::unique_ptr< BOARD_ITEM > | ReadBoardItemFromStream (std::istream &aStream) |
| Utility function to read a BOARD_ITEM (probably a FOOTPRINT or a BOARD) from a file. | |
| std::unique_ptr< BOARD > | ReadBoardFromFileOrStream (const std::string &aFilename, std::istream &aFallback=std::cin) |
| Read a board from a file, or another stream, as appropriate. | |
| std::unique_ptr< FOOTPRINT > | ReadFootprintFromFileOrStream (const std::string &aFilename, std::istream &aFallback) |
| void | DumpFootprintToFile (const FOOTPRINT &aFootprint, const std::string &aLibraryPath) |
| Same as DumpBoardToFile, but for footprints. | |
| void | LoadBoard (SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard) |
| BOARD_ITEM & | RequireBoardItemWithTypeAndId (const BOARD &aBoard, KICAD_T aItemType, const KIID &aID) |
| Get an item from the given board with a certain type and UUID. | |
| void | LoadAndTestBoardFile (const wxString aRelativePath, bool aRoundtrip, std::function< void(BOARD &)> aBoardTestFunction, std::optional< int > aExpectedBoardVersion=std::nullopt) |
| Perform "some test" on a board file loaded from the path, then optionally save and reload and run the test again. | |
| void | LoadAndTestFootprintFile (const wxString &aLibRelativePath, const wxString &aFpName, bool aRoundtrip, std::function< void(FOOTPRINT &)> aFootprintTestFunction, std::optional< int > aExpectedFootprintVersion) |
| Same as LoadAndTestBoardFile, but for footprints. | |
| void | FillZones (BOARD *m_board) |
| void | CheckFootprint (const FOOTPRINT *expected, const FOOTPRINT *fp) |
| Helper method to check if two footprints are semantically the same. | |
| void | CheckFpPad (const PAD *expected, const PAD *pad) |
| void | CheckFpText (const PCB_TEXT *expected, const PCB_TEXT *text) |
| void | CheckFpShape (const PCB_SHAPE *expected, const PCB_SHAPE *shape) |
| void | CheckFpZone (const ZONE *expected, const ZONE *zone) |
| void | CheckShapePolySet (const SHAPE_POLY_SET *expected, const SHAPE_POLY_SET *polyset) |
| void | PrintBoardStats (const BOARD *aBoard, const std::string &aBoardName) |
| Print detailed board statistics for debugging using test-framework logging. | |
| std::unique_ptr< BOARD > | LoadBoardWithCapture (PCB_IO &aIoPlugin, const std::string &aFilePath, REPORTER *aReporter) |
| Attempt to load an board with a given IO plugin, capturing all reporter messages. | |
| template<typename ITEM> | |
| std::unique_ptr< ITEM > | ReadItemFromStream (std::istream &aStream) |
| Read a specific kind of BOARD_ITEM from a stream. | |
| SHAPE_LINE_CHAIN | BuildRectChain (const VECTOR2I &aSize, const VECTOR2I &aCentre={ 0, 0 }) |
| Builds a rectangular SHAPE_LINE_CHAIN of a certain size at a certain centre. | |
| SHAPE_LINE_CHAIN | BuildSquareChain (int aSize, const VECTOR2I &aCentre={ 0, 0 }) |
| Builds a square SHAPE_LINE_CHAIN of a certain size at a certain centre. | |
| SHAPE_POLY_SET | BuildPolyset (const std::vector< SHAPE_LINE_CHAIN > &aOutlines) |
| Construct a SHAPE_POLY_SET from a list of points for each of outlines (no holes) | |
| SHAPE_POLY_SET | BuildHollowSquare (int aOuterSize, int aInnerSize, const VECTOR2I &aCentre={ 0, 0 }) |
| Build a SHAPE_POLY_SET in the shape of a square outline, with a square hole, both centred at the given point. | |
| SEG | BuildHSeg (const VECTOR2I &aStart, int aLength) |
| Build a horizontal segment from a point with a length. | |
| SEG | BuildVSeg (const VECTOR2I &aStart, int aLength) |
| Build a vertical segment from a point with a length. | |
| template<typename VEC> | |
| bool | IsVecWithinTol (const VEC &aVec, const VEC &aExp, typename VEC::coord_type aTol) |
| Check that both x and y of a vector are within expected error. | |
| template<typename BOX> | |
| bool | IsBoxWithinTol (const BOX &aBox, const BOX &aExp, typename BOX::coord_type aTol) |
| Check that a box is close enough to another box. | |
| template<typename T> | |
| bool | IsWithinWrapped (T aValue, T aNominal, T aWrap, T aError) |
| Check if a value is within a tolerance of a nominal value, wrapping to a given val. | |
| template<typename T> | |
| bool | IsWithin (T aValue, T aNominal, T aError) |
| Check if a value is within a tolerance of a nominal value. | |
| template<typename T> | |
| bool | IsWithinBounds (T aValue, T aNominal, T aErrorAbove, T aErrorBelow) |
| Check if a value is within a tolerance of a nominal value, with different allowances for errors above and below. | |
| template<typename T> | |
| bool | IsWithinAndBelow (T aValue, T aNominal, T aErrorBelow) |
| value is in range [aNominal - aErrorBelow, aNominal] | |
| template<typename T> | |
| bool | IsWithinAndAbove (T aValue, T aNominal, T aErrorAbove) |
| value is in range [aNominal, aNominal + aErrorAbove] | |
| bool | IsUUID (const std::string &aStr) |
| Check if the string between the iterators looks like a UUID. | |
| bool | IsUUIDPathWithLevels (const std::string &aStr, unsigned aLevels) |
| Predicate to check a string is a UUID path format. | |
| template<typename EXP_CONT, typename FOUND_CONT, typename MATCH_PRED> | |
| void | CheckUnorderedMatches (const EXP_CONT &aExpected, const FOUND_CONT &aFound, MATCH_PRED aMatchPredicate) |
| Check that a container of "found" objects matches a container of "expected" objects. | |
| template<typename T> | |
| bool | CollectionHasNoDuplicates (const T &aCollection) |
| Predicate to check a collection has no duplicate elements. | |
| std::string | GetEeschemaTestDataDir () |
| Get the configured location of Eeschema test data. | |
| std::string | GetTestDataRootDir () |
| std::vector< uint8_t > | LoadBinaryData (const std::string &aFilePath, std::optional< size_t > aLoadBytes=std::nullopt) |
| Load the contents of a file into a vector of bytes. | |
| void | SetMockConfigDir () |
| void | wxAssertThrower (const wxString &aFile, int aLine, const wxString &aFunc, const wxString &aCond, const wxString &aMsg) |
| void | DumpSchematicToFile (SCHEMATIC &aSchematic, SCH_SHEET &aSheet, const std::string &aFilename) |
| void | LoadSheetSchematicContents (const std::string &fileName, SCH_SHEET *sheet) |
| void | LoadHierarchy (SCHEMATIC *schematic, SCH_SHEET *sheet, const std::string &sheetFilename, std::unordered_map< std::string, SCH_SCREEN * > &parsedScreens) |
| std::unique_ptr< SCHEMATIC > | LoadHierarchyFromRoot (const std::string &rootFilename, PROJECT *project) |
| void | LoadSchematic (SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic) |
| std::unique_ptr< SCHEMATIC > | ReadSchematicFromStream (std::istream &aStream, PROJECT *aProject) |
| std::unique_ptr< SCHEMATIC > | ReadSchematicFromFile (const std::string &aFilename, PROJECT *aProject) |
| bool | IsColorNear (const KIGFX::COLOR4D &aCol, const KIGFX::COLOR4D aOther, double aTol) |
| Checks if a COLOR4D is close enough to another. | |
| bool | IsColorNearHex (const KIGFX::COLOR4D &aCol, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
| Checks if a COLOR4D is close enough to a given RGB char value. | |
| bool | IsImagePixelOfColor (const wxImage &aImage, int aX, int aY, const KIGFX::COLOR4D &aColor) |
| Predicate to check an image pixel matches color and alpha. | |
| bool | ImagesHaveSamePixels (const wxImage &aImgA, const wxImage &aImgB) |
| Check if an image is identical to another image, pixel by pixel. | |
| bool | FieldNameIdMatches (const SCH_FIELD &aField, const std::string &aExpectedName, int aExpectedId) |
| Predicate to check a field name is as expected. | |
| bool | AreDefaultFieldsCorrect (const std::vector< SCH_FIELD > &aFields) |
| Predicate to check that the mandatory fields look sensible. | |
| SEXPR::SEXPR_TYPE | getType (const SEXPR::SEXPR &aSexpr) |
| Get the type of the s-expression. | |
| std::string | getDebugType (SEXPR::SEXPR_TYPE aType) |
| Get a debug-friendly string for a given s-expr type. | |
| std::string | GetSexprDebugType (const SEXPR::SEXPR &aSexpr) |
| bool | IsSexprOfType (const SEXPR::SEXPR &aSexpr, SEXPR::SEXPR_TYPE aType) |
| template<typename VAL_T> | |
| bool | IsSexprValueEqual (const VAL_T &aGot, const VAL_T &aExpected) |
| Predicate to check two s-expr values (of the same type) are equal. | |
| bool | SexprIsSymbol (const SEXPR::SEXPR &aSexpr) |
| Test predicate: is the s-expression a symbol? | |
| bool | SexprIsSymbolWithValue (const SEXPR::SEXPR &aSexpr, const std::string &aVal) |
| Test predicate: is the s-expression a symbol with the given value? | |
| bool | SexprIsString (const SEXPR::SEXPR &aSexpr) |
| Test predicate: is the s-expression a string? | |
| bool | SexprIsStringWithValue (const SEXPR::SEXPR &aSexpr, const std::string &aVal) |
| Test predicate: is the s-expression a string with the given value? | |
| bool | SexprIsInteger (const SEXPR::SEXPR &aSexpr) |
| Test predicate: is the s-expression an integer? | |
| bool | SexprIsIntegerWithValue (const SEXPR::SEXPR &aSexpr, std::int64_t aVal) |
| Test predicate: is the s-expression an integer with the given value? | |
| bool | SexprIsDouble (const SEXPR::SEXPR &aSexpr) |
| Test predicate: is the s-expression a double? | |
| bool | SexprIsDoubleWithValue (const SEXPR::SEXPR &aSexpr, double aVal) |
| Test predicate: is the s-expression a double with the given value? | |
| bool | SexprIsList (const SEXPR::SEXPR &aSexpr) |
| Test predicate: is the s-expression a double? | |
| bool | SexprIsListOfLength (const SEXPR::SEXPR &aSexpr, size_t aExpectedLength) |
| Test predicate: is the s-expression a list with the given length? | |
| bool | SexprConvertsToString (const SEXPR::SEXPR &aSexpr, const std::string &aExpStr) |
| Predicate to check an SEXPR object converts to the expected string. | |
| bool | IsDrcMarkerOfType (const PCB_MARKER &aMarker, int aErrorCode) |
| Predicate for testing the type of a DRC marker. | |
| void | RunAdditionalBlockTest (const std::string &aBoardName, size_t aBlockOffset, const ALLEGRO::BLOCK_BASE &aBlock) |
| Look up and run any additional ad-hoc tests for a block. | |
| void | RunAdditionalObjectTest (const std::string &aBoardName, size_t aBlockOffset, const ALLEGRO::DB_OBJ &aDbObj) |
| Look up and run any additional ad-hoc tests for a DB_OBJ (parsed and converted block) | |
| std::string | AllegroBoardDataDir (const std::string &aBoardName) |
| std::string | AllegroBoardFile (const std::string &aFileName) |
| using KI_TEST::EXP_OBJ = typename EXP_CONT::value_type |
Definition at line 199 of file unit_test_utils.h.
| using KI_TEST::FOUND_OBJ = typename FOUND_CONT::value_type |
Definition at line 200 of file unit_test_utils.h.
| using KI_TEST::MATCH_PRED = std::function<bool( const EXP_OBJ&, const FOUND_OBJ& )> |
A match predicate: check that a "found" object is equivalent to or represents an "expected" object, perhaps of a different type.
Exactly what "equivalent to" means depends heavily on the context and what is care about. For example, if you only care about a FOOTPRINT's refdes, std::string is sufficient to indicate a "match".
This can be used, for example, for checking a set of results without having to instantiate a full result object for checking by equality.
Definition at line 219 of file unit_test_utils.h.
| enum KI_TEST::RET_CODES |
Return codes for tools.
Definition at line 38 of file utility_program.h.
| std::string KI_TEST::AllegroBoardDataDir | ( | const std::string & | aBoardName | ) |
Definition at line 45 of file allegro_test_utils.cpp.
References getBoardsDataDir().
Referenced by buildTestRegistry(), createBoardTestInfo(), ALLEGRO_COMPREHENSIVE_FIXTURE::GetAllBoardFiles(), getBoardsWithAlg(), ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest(), RunBoardExpectations(), RunBoardLoad(), and ALLEGRO_BLOCK_TEST_FIXTURE::RunHeaderTest().
| std::string KI_TEST::AllegroBoardFile | ( | const std::string & | aFileName | ) |
Definition at line 56 of file allegro_test_utils.cpp.
References getBoardsDataDir().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and ALLEGRO_IMPORT_FIXTURE::LoadAllegroBoard().
| bool KI_TEST::AreDefaultFieldsCorrect | ( | const std::vector< SCH_FIELD > & | aFields | ) |
Predicate to check that the mandatory fields look sensible.
Definition at line 86 of file lib_field_test_utils.h.
References BOOST_TEST_INFO(), DATASHEET, FieldNameIdMatches(), FOOTPRINT, REFERENCE, and VALUE.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| SHAPE_POLY_SET KI_TEST::BuildHollowSquare | ( | int | aOuterSize, |
| int | aInnerSize, | ||
| const VECTOR2I & | aCentre = { 0, 0 } ) |
Build a SHAPE_POLY_SET in the shape of a square outline, with a square hole, both centred at the given point.
| aOuterSize | the size (x and y) of the outer square |
| aInnerSize | the size (x and y) of the hole |
| aCentre | the centre point of both squares (default: origin) |
Definition at line 44 of file poly_set_construction.cpp.
References SHAPE_POLY_SET::AddHole(), SHAPE_POLY_SET::AddOutline(), and BuildRectChain().
Build a horizontal segment from a point with a length.
| aStart | the starting point |
| aLength | the segment length |
Definition at line 29 of file seg_construction.cpp.
References VECTOR2< T >::x, and VECTOR2< T >::y.
| SHAPE_POLY_SET KI_TEST::BuildPolyset | ( | const std::vector< SHAPE_LINE_CHAIN > & | aOutlines | ) |
Construct a SHAPE_POLY_SET from a list of points for each of outlines (no holes)
Definition at line 31 of file poly_set_construction.cpp.
References SHAPE_POLY_SET::AddOutline().
| SHAPE_LINE_CHAIN KI_TEST::BuildRectChain | ( | const VECTOR2I & | aSize, |
| const VECTOR2I & | aCentre = { 0, 0 } ) |
Builds a rectangular SHAPE_LINE_CHAIN of a certain size at a certain centre.
| aSize | the rectangle size |
| aCentre | centre of the rectangle |
Definition at line 29 of file line_chain_construction.cpp.
References chain, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BuildHollowSquare(), and BuildSquareChain().
| SHAPE_LINE_CHAIN KI_TEST::BuildSquareChain | ( | int | aSize, |
| const VECTOR2I & | aCentre = { 0, 0 } ) |
Builds a square SHAPE_LINE_CHAIN of a certain size at a certain centre.
| aSize | the square size (x == y) |
| aCentre | centre of the square |
Definition at line 44 of file line_chain_construction.cpp.
References BuildRectChain().
Referenced by TestSquareFillet().
Build a vertical segment from a point with a length.
| aStart | the starting point |
| aLength | the segment length |
Definition at line 34 of file seg_construction.cpp.
References VECTOR2< T >::x, and VECTOR2< T >::y.
Helper method to check if two footprints are semantically the same.
Definition at line 400 of file board_test_utils.cpp.
References BOOST_CHECK_EQUAL(), CHECK_ENUM_CLASS_EQUAL, CheckFpPad(), CheckFpShape(), CheckFpText(), CheckFpZone(), BOARD_ITEM::DRC, expected, FOOTPRINT::GetAttributes(), FOOTPRINT::GetFields(), FOOTPRINT::GetFlag(), FOOTPRINT::GetKeywords(), FOOTPRINT::GetLibDescription(), WX_STRING_REPORTER::GetMessages(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), FOOTPRINT::GetReference(), FOOTPRINT::GetTypeName(), FOOTPRINT::GetValue(), FOOTPRINT::GraphicalItems(), FOOTPRINT::Groups(), FOOTPRINT::Models(), FOOTPRINT::Pads(), PCB_BARCODE_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_SHAPE_T, PCB_TEXT_T, text, EDA_ITEM::Type(), and FOOTPRINT::Zones().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_DATA_TEST_CASE().
Definition at line 505 of file board_test_utils.cpp.
References PADSTACK::ALL_LAYERS, BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), CHECK_ENUM_CLASS_EQUAL, CheckFpShape(), expected, and pad.
Referenced by CheckFootprint().
Definition at line 613 of file board_test_utils.cpp.
References ARC, BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), CHECK_ENUM_CLASS_EQUAL, CheckShapePolySet(), expected, EDA_SHAPE::GetArcMid(), EDA_SHAPE::GetBezierC1(), EDA_SHAPE::GetBezierC2(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetFillMode(), PCB_SHAPE::GetLayerSet(), STROKE_PARAMS::GetLineStyle(), EDA_SHAPE::GetPolyShape(), PCB_SHAPE::GetPosition(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), PCB_SHAPE::GetStroke(), STROKE_PARAMS::GetWidth(), BOARD_ITEM::IsLocked(), and EDA_ITEM::Type().
Referenced by CheckFootprint(), and CheckFpPad().
Definition at line 582 of file board_test_utils.cpp.
References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), CHECK_ENUM_CLASS_EQUAL, expected, and text.
Referenced by CheckFootprint().
Definition at line 652 of file board_test_utils.cpp.
References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), CHECK_ENUM_CLASS_EQUAL, CheckShapePolySet(), expected, ZONE::GetAssignedPriority(), ZONE::GetCornerRadius(), ZONE::GetCornerSmoothingType(), ZONE::GetDoNotAllowFootprints(), ZONE::GetDoNotAllowPads(), ZONE::GetDoNotAllowTracks(), ZONE::GetDoNotAllowVias(), ZONE::GetDoNotAllowZoneFills(), ZONE::GetFillMode(), ZONE::GetHatchBorderAlgorithm(), ZONE::GetHatchGap(), ZONE::GetHatchHoleMinArea(), ZONE::GetHatchOrientation(), ZONE::GetHatchSmoothingLevel(), ZONE::GetHatchSmoothingValue(), ZONE::GetHatchThickness(), ZONE::GetIslandRemovalMode(), ZONE::GetIsRuleArea(), ZONE::GetLayerSet(), ZONE::GetLocalClearance(), ZONE::GetMinIslandArea(), ZONE::GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::GetPadConnection(), ZONE::GetTeardropAreaType(), ZONE::GetThermalReliefGap(), ZONE::GetThermalReliefSpokeWidth(), ZONE::GetZoneName(), ZONE::IsFilled(), BOARD_ITEM::IsLocked(), ZONE::Outline(), and EDA_ITEM::Type().
Referenced by CheckFootprint().
| void KI_TEST::CheckShapePolySet | ( | const SHAPE_POLY_SET * | expected, |
| const SHAPE_POLY_SET * | polyset ) |
Definition at line 703 of file board_test_utils.cpp.
References SHAPE_LINE_CHAIN::ArcCount(), BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), expected, SHAPE_LINE_CHAIN::GetPoint(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), and SHAPE_POLY_SET::TotalVertices().
Referenced by CheckFpShape(), and CheckFpZone().
| void KI_TEST::CheckUnorderedMatches | ( | const EXP_CONT & | aExpected, |
| const FOUND_CONT & | aFound, | ||
| MATCH_PRED | aMatchPredicate ) |
Check that a container of "found" objects matches a container of "expected" objects.
This means that:
This is a very generic function: all you need are two containers of any type and a function to check if a given "found" object corresponds to a given "expected object". Conditions:
operator<< (for logging)Not needed:
This is a slightly more complex way of doing it that, say, sorting both lists and checking element-by-element matches. However, it can tell you exactly which objects are problematic, as well as a simple go/no-go.
When you have two containers of identical types (or you have a suitable operator==) and ordering is important, you can use BOOST_CHECK_EQUAL_COLLECTIONS
| aExpected | a container of "expected" items, usually from a test case |
| aMatched | a container of "found" items, usually the result of some routine under test |
| aMatchPredicate | a predicate that determines if a given "found" object matches a given "expected" object. |
Definition at line 256 of file unit_test_utils.h.
References expected.
Referenced by BOOST_AUTO_TEST_CASE(), CheckCollisionsMatchExpected(), and CheckInvalidsMatchExpected().
Predicate to check a collection has no duplicate elements.
Definition at line 302 of file unit_test_utils.h.
References T.
Referenced by BOOST_AUTO_TEST_CASE().
| void KI_TEST::DrawArc | ( | FOOTPRINT & | aFootprint, |
| const VECTOR2I & | aCentre, | ||
| const VECTOR2I & | aStart, | ||
| const EDA_ANGLE & | aAngle, | ||
| int | aWidth, | ||
| PCB_LAYER_ID | aLayer ) |
Draw an arc on a footprint.
| aMod | The footprint to add the segment to |
| aCentre | The arc centre |
| aStart | The arc start point |
| aAngle | The arc angle |
| aWidth | The width of the arc segment |
| aLayer | The layer to draw on |
Definition at line 62 of file board_construction_utils.cpp.
References FOOTPRINT::Add(), ARC, FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), and SOLID.
Referenced by DrawRect().
| void KI_TEST::DrawPolyline | ( | FOOTPRINT & | aFootprint, |
| const std::vector< VECTOR2I > & | aPts, | ||
| int | aWidth, | ||
| PCB_LAYER_ID | aLayer ) |
Draw a polyline - a set of linked segments.
| aMod | The footprint to add the segment to |
| aPts | The polyline points |
| aWidth | The width of the segments |
| aLayer | The layer to draw on |
Definition at line 52 of file board_construction_utils.cpp.
References DrawSegment().
| void KI_TEST::DrawRect | ( | FOOTPRINT & | aFootprint, |
| const VECTOR2I & | aPos, | ||
| const VECTOR2I & | aSize, | ||
| int | aRadius, | ||
| int | aWidth, | ||
| PCB_LAYER_ID | aLayer ) |
Draw a rectangle on a footprint.
| aMod | The footprint to add the rectangle to |
| aPos | Rectangle centre point |
| aSize | Rectangle size (x, y) |
| aRadius | Corner radius (0 for a normal rect) |
| aWidth | Line width |
| aLayer | Layer to draw on |
Definition at line 81 of file board_construction_utils.cpp.
References ANGLE_90, DrawArc(), DrawSegment(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddRectCourtyard().
| void KI_TEST::DrawSegment | ( | FOOTPRINT & | aFootprint, |
| const SEG & | aSeg, | ||
| int | aWidth, | ||
| PCB_LAYER_ID | aLayer ) |
Draw a segment in the given footprint.
| aMod | The footprint to add the segment to |
| aSeg | The segment geometry |
| aWidth | The width of the segment |
| aLayer | The layer to draw on |
Definition at line 35 of file board_construction_utils.cpp.
References SEG::A, FOOTPRINT::Add(), SEG::B, FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), SEGMENT, and SOLID.
Referenced by DrawPolyline(), DrawRect(), and MakeInvalidCourtyardTestFP().
| void KI_TEST::DumpBoardToFile | ( | BOARD & | aBoard, |
| const std::string & | aFilename ) |
Utility function to simply write a Board out to a file.
Helps debug tests and utility programs by making it easy to quickly write to disk without directly using the PCB_IO_KICAD_SEXPR API.
Note: The aBoard param is non-const because PCB_IO_KICAD_SEXPR::Save demands it and I am not confident a const_cast will be a true assurance.
| aBoard | the board to write out |
| aFilename | the filename to write to |
Definition at line 65 of file board_file_utils.cpp.
References PCB_IO_KICAD_SEXPR::SaveBoard().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_DATA_TEST_CASE_F(), KI_TEST::BOARD_DUMPER::DumpBoardToFile(), LoadAndTestBoardFile(), SaveBoardToString(), and testSaveLoad().
| void KI_TEST::DumpFootprintToFile | ( | const FOOTPRINT & | aFootprint, |
| const std::string & | aLibraryPath ) |
Same as DumpBoardToFile, but for footprints.
Definition at line 148 of file board_file_utils.cpp.
References PCB_IO_KICAD_SEXPR::FootprintSave().
Referenced by BOOST_AUTO_TEST_CASE(), and LoadAndTestFootprintFile().
| void KI_TEST::DumpSchematicToFile | ( | SCHEMATIC & | aSchematic, |
| SCH_SHEET & | aSheet, | ||
| const std::string & | aFilename ) |
Definition at line 41 of file schematic_file_util.cpp.
References SCH_IO_KICAD_SEXPR::SaveSchematicFile().
| bool KI_TEST::FieldNameIdMatches | ( | const SCH_FIELD & | aField, |
| const std::string & | aExpectedName, | ||
| int | aExpectedId ) |
Predicate to check a field name is as expected.
| aField | SCH_FIELD to check the name |
| aExpectedName | the expected field name |
| aExpectedId | the expected field id |
Definition at line 61 of file lib_field_test_utils.h.
References BOOST_TEST_INFO(), SCH_FIELD::GetCanonicalName(), and SCH_FIELD::GetId().
Referenced by AreDefaultFieldsCorrect(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| void KI_TEST::FillZones | ( | BOARD * | m_board | ) |
Definition at line 336 of file board_test_utils.cpp.
References _, BOARD::BuildConnectivity(), ZONE_FILLER::Fill(), BOARD_COMMIT::Push(), TOOL_MANAGER::RegisterTool(), TOOL_MANAGER::SetEnvironment(), SKIP_CONNECTIVITY, SKIP_SET_DIRTY, SKIP_UNDO, ZONE_FILL_OP, and BOARD::Zones().
Referenced by BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and BACKDRILL_TEST_FIXTURE::FillZones().
|
inline |
Get a debug-friendly string for a given s-expr type.
Definition at line 57 of file sexpr_test_utils.h.
References SEXPR::SEXPR_TYPE_ATOM_DOUBLE, SEXPR::SEXPR_TYPE_ATOM_INTEGER, SEXPR::SEXPR_TYPE_ATOM_STRING, SEXPR::SEXPR_TYPE_ATOM_SYMBOL, and SEXPR::SEXPR_TYPE_LIST.
Referenced by GetSexprDebugType(), and IsSexprOfType().
| std::string KI_TEST::GetEeschemaTestDataDir | ( | ) |
Get the configured location of Eeschema test data.
By default, this is the test data in the source tree, but can be overridden by the KICAD_TEST_EESCHEMA_DATA_DIR environment variable.
Definition at line 39 of file unit_test_utils.cpp.
References GetTestDataRootDir().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), getCadstarTestFile(), getEagleTestSchematic(), TEST_SIM_LIBRARY_SPICE_FIXTURE::GetLibraryPath(), GEDA_SCH_IMPORT_FIXTURE::LoadGedaSchematic(), GEDA_SCH_IMPORT_FIXTURE::LoadGedaSchematicWithProperties(), LoadSchematic(), SAVEAS_SUBSHEET_FIXTURE::SAVEAS_SUBSHEET_FIXTURE(), KI_TEST::SCHEMATIC_TEST_FIXTURE::SchematicQAPath(), TEST_NETLIST_EXPORTER_SPICE_FIXTURE::SchematicQAPath(), TEST_SCH_GROUP_FIXTURE::SchematicQAPath(), TEST_SCH_SCREEN_FIXTURE::SchematicQAPath(), TEST_SCH_SHEET_LIST_FIXTURE::SchematicQAPath(), TEST_SCHEMATIC_FIXTURE::SchematicQAPath(), and TEST_SIM_REGRESSIONS_FIXTURE::SchematicQAPath().
| std::string KI_TEST::GetPcbnewTestDataDir | ( | ) |
Utility which returns a path to the data directory where the test board files are stored.
Definition at line 42 of file board_file_utils.cpp.
References QA_PCBNEW_DATA_LOCATION.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), createTestCases(), GetAscPath(), GetBinaryPath(), GetBoardPath(), getBoardsDataDir(), IPC2581_EXPORT_FIXTURE::GetXsdPath(), LoadAndTestBoardFile(), LoadAndTestFootprintFile(), IPC2581_EXPORT_FIXTURE::LoadBoard(), LoadBoard(), and DRC_BASE_FIXTURE::saveBoardAndProjectToTempFiles().
|
inline |
Definition at line 76 of file sexpr_test_utils.h.
References getDebugType(), and getType().
Referenced by SEXPR::boost_test_print_type().
| std::string KI_TEST::GetTestDataRootDir | ( | ) |
Definition at line 68 of file unit_test_utils.cpp.
References QA_DATA_ROOT.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), GetEeschemaTestDataDir(), SetMockConfigDir(), and TEST_SYMBOL_IMPORT_MANAGER_FIXTURE::TEST_SYMBOL_IMPORT_MANAGER_FIXTURE().
|
inline |
Get the type of the s-expression.
Definition at line 38 of file sexpr_test_utils.h.
References SEXPR::SEXPR::IsDouble(), SEXPR::SEXPR::IsInteger(), SEXPR::SEXPR::IsList(), SEXPR::SEXPR::IsString(), SEXPR::SEXPR::IsSymbol(), SEXPR::SEXPR_TYPE_ATOM_DOUBLE, SEXPR::SEXPR_TYPE_ATOM_INTEGER, SEXPR::SEXPR_TYPE_ATOM_STRING, SEXPR::SEXPR_TYPE_ATOM_SYMBOL, and SEXPR::SEXPR_TYPE_LIST.
Referenced by GetSexprDebugType(), and IsSexprOfType().
| bool KI_TEST::ImagesHaveSamePixels | ( | const wxImage & | aImgA, |
| const wxImage & | aImgB ) |
Check if an image is identical to another image, pixel by pixel.
(this is exhaustive, avoid using it for large images)
Definition at line 60 of file wximage_test_utils.cpp.
References BOOST_TEST_INFO().
Referenced by BOOST_AUTO_TEST_CASE().
| bool KI_TEST::IsBoxWithinTol | ( | const BOX & | aBox, |
| const BOX & | aExp, | ||
| typename BOX::coord_type | aTol ) |
Check that a box is close enough to another box.
Definition at line 61 of file geometry.h.
References IsVecWithinTol().
Referenced by CheckArcGeom().
|
inline |
Checks if a COLOR4D is close enough to another.
Definition at line 41 of file color4d_test_utils.h.
References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, IsWithin(), and KIGFX::COLOR4D::r.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Checks if a COLOR4D is close enough to a given RGB char value.
Definition at line 52 of file color4d_test_utils.h.
References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, IsWithin(), and KIGFX::COLOR4D::r.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and IsImagePixelOfColor().
| bool KI_TEST::IsDrcMarkerOfType | ( | const PCB_MARKER & | aMarker, |
| int | aErrorCode ) |
Predicate for testing the type of a DRC marker.
| aMarker | the marker to test |
| aErrorCode | the expected DRC violation code |
Definition at line 41 of file drc_test_utils.cpp.
References RC_ITEM::GetErrorCode(), and MARKER_BASE::GetRCItem().
Referenced by CheckCollisionsMatchExpected().
| bool KI_TEST::IsImagePixelOfColor | ( | const wxImage & | aImage, |
| int | aX, | ||
| int | aY, | ||
| const KIGFX::COLOR4D & | aColor ) |
Predicate to check an image pixel matches color and alpha.
| aImage | the image to check |
| aX | pixel x-coordinate |
| aY | pixel y-coordinate |
| aColor | expected color (alpha is 1.0 if image doesn't support alpha) |
Definition at line 32 of file wximage_test_utils.cpp.
References BOOST_TEST_INFO(), and IsColorNearHex().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 81 of file sexpr_test_utils.h.
References BOOST_TEST_MESSAGE(), getDebugType(), and getType().
Referenced by SexprIsDouble(), SexprIsDoubleWithValue(), SexprIsInteger(), SexprIsIntegerWithValue(), SexprIsList(), SexprIsListOfLength(), SexprIsString(), SexprIsStringWithValue(), SexprIsSymbol(), and SexprIsSymbolWithValue().
| bool KI_TEST::IsSexprValueEqual | ( | const VAL_T & | aGot, |
| const VAL_T & | aExpected ) |
Predicate to check two s-expr values (of the same type) are equal.
Definition at line 98 of file sexpr_test_utils.h.
References BOOST_TEST_MESSAGE().
Referenced by SexprIsDoubleWithValue(), SexprIsIntegerWithValue(), SexprIsStringWithValue(), and SexprIsSymbolWithValue().
| bool KI_TEST::IsUUID | ( | const std::string & | aStr | ) |
Check if the string between the iterators looks like a UUID.
Definition at line 30 of file uuid_test_utils.cpp.
Referenced by IsUUIDPathWithLevels().
| bool KI_TEST::IsUUIDPathWithLevels | ( | const std::string & | aStr, |
| unsigned | aLevels ) |
Predicate to check a string is a UUID path format.
Eg. levels=2: /1d33ca6f-67e8-41ae-a0aa-49d857ab38d5/1d33ca6f-67e8-41ae-a0aa-49d857ab38d5/
| aStr | candidate string |
| levels | expected levels |
Definition at line 39 of file uuid_test_utils.cpp.
References BOOST_TEST_INFO(), and IsUUID().
Referenced by BOOST_AUTO_TEST_CASE().
| bool KI_TEST::IsVecWithinTol | ( | const VEC & | aVec, |
| const VEC & | aExp, | ||
| typename VEC::coord_type | aTol ) |
Check that both x and y of a vector are within expected error.
Definition at line 51 of file geometry.h.
References IsWithin().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CheckArcGeom(), IsBoxWithinTol(), and TransformIsClose().
Check if a value is within a tolerance of a nominal value.
Definition at line 61 of file numeric.h.
References T.
Referenced by GEOM_TEST::ArePerpendicular(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CheckArcGeom(), IsColorNear(), IsColorNearHex(), GEOM_TEST::IsPointAtDistance(), IsVecWithinTol(), and TransformIsClose().
value is in range [aNominal, aNominal + aErrorAbove]
Definition at line 88 of file numeric.h.
References IsWithinBounds(), and T.
value is in range [aNominal - aErrorBelow, aNominal]
Definition at line 80 of file numeric.h.
References IsWithinBounds(), and T.
Referenced by TestFilletSegmentConstraints().
| bool KI_TEST::IsWithinBounds | ( | T | aValue, |
| T | aNominal, | ||
| T | aErrorAbove, | ||
| T | aErrorBelow ) |
Check if a value is within a tolerance of a nominal value, with different allowances for errors above and below.
Definition at line 72 of file numeric.h.
References T.
Referenced by IsWithinAndAbove(), and IsWithinAndBelow().
Check if a value is within a tolerance of a nominal value, wrapping to a given val.
Definition at line 43 of file numeric.h.
References std::abs(), and T.
Referenced by BOOST_AUTO_TEST_CASE(), and CheckArcGeom().
| void KI_TEST::LoadAndTestBoardFile | ( | const wxString | aRelativePath, |
| bool | aRoundtrip, | ||
| std::function< void(BOARD &)> | aBoardTestFunction, | ||
| std::optional< int > | aExpectedBoardVersion = std::nullopt ) |
Perform "some test" on a board file loaded from the path, then optionally save and reload and run the test again.
The roundtrip is useful to test stability of serialisation/reload.
| aRelativePath | relative path of file to load |
| aRoundtrip | true to save, reload and re-test |
| aBoardTestFunction | the function that runs tests on the board |
| aExpectedBoardVersion | the expected board version, or nullopt to not check |
Definition at line 241 of file board_test_utils.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), DumpBoardToFile(), KI_TEST::TEMPORARY_DIRECTORY::GetPath(), GetPcbnewTestDataDir(), and ReadBoardFromFileOrStream().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE_F(), and BOOST_FIXTURE_TEST_CASE().
| void KI_TEST::LoadAndTestFootprintFile | ( | const wxString & | aLibRelativePath, |
| const wxString & | aFpName, | ||
| bool | aRoundtrip, | ||
| std::function< void(FOOTPRINT &)> | aFootprintTestFunction, | ||
| std::optional< int > | aExpectedFootprintVersion ) |
Same as LoadAndTestBoardFile, but for footprints.
Use a temporary directory, so that if something goes wrong and the file isn't written properly, we don't leave a library behind that will cause exceptions when the cache is set up on future runs.
Definition at line 282 of file board_test_utils.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), DumpFootprintToFile(), KI_TEST::TEMPORARY_DIRECTORY::GetPath(), GetPcbnewTestDataDir(), and ReadFootprintFromFileOrStream().
Referenced by BOOST_DATA_TEST_CASE().
| std::vector< uint8_t > KI_TEST::LoadBinaryData | ( | const std::string & | aFilePath, |
| std::optional< size_t > | aLoadBytes = std::nullopt ) |
Load the contents of a file into a vector of bytes.
If this fails, it throws a std::runtime_error with a descriptive message.
| aFilePath | the path to the file to load |
| aLoadBytes | the number of bytes to load, or all bytes if not specified |
Definition at line 92 of file unit_test_utils.cpp.
Referenced by loadDataByUri().
| void KI_TEST::LoadBoard | ( | SETTINGS_MANAGER & | aSettingsManager, |
| const wxString & | aRelPath, | ||
| std::unique_ptr< BOARD > & | aBoard ) |
Definition at line 74 of file board_test_utils.cpp.
References BOOST_TEST_MESSAGE(), dummy, GetPcbnewTestDataDir(), SETTINGS_MANAGER::LoadProject(), SETTINGS_MANAGER::Prj(), ReadBoardFromFileOrStream(), DRC_CACHE_GENERATOR::Run(), DRC_TEST_PROVIDER::SetDRCEngine(), and IO_ERROR::What().
Referenced by BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), DRC_BASE_FIXTURE::loadBoardAndVerifyInitialExclusions(), and DRC_BASE_FIXTURE::reloadBoardAndVerifyExclusions().
| std::unique_ptr< BOARD > KI_TEST::LoadBoardWithCapture | ( | PCB_IO & | aIoPlugin, |
| const std::string & | aFilePath, | ||
| REPORTER * | aReporter ) |
Attempt to load an board with a given IO plugin, capturing all reporter messages.
Returns the board (or nullptr on failure) and populates the reporter.
Definition at line 844 of file board_test_utils.cpp.
References PCB_IO::LoadBoard(), REPORTER::Report(), RPT_SEVERITY_ERROR, IO_BASE::SetReporter(), IO_ERROR::What(), and IO_ERROR::what().
Referenced by KI_TEST::CACHED_BOARD_LOADER::getCachedBoard().
| void KI_TEST::LoadHierarchy | ( | SCHEMATIC * | schematic, |
| SCH_SHEET * | sheet, | ||
| const std::string & | sheetFilename, | ||
| std::unordered_map< std::string, SCH_SCREEN * > & | parsedScreens ) |
Definition at line 58 of file schematic_file_util.cpp.
References SCH_SHEET::GetFileName(), SCH_SHEET::GetScreen(), SCH_SCREEN::Items(), LoadHierarchy(), LoadSheetSchematicContents(), EE_RTREE::OfType(), SCH_SHEET_T, SCH_SCREEN::SetFileName(), EDA_ITEM::SetParent(), and SCH_SHEET::SetScreen().
Referenced by LoadHierarchy(), and LoadHierarchyFromRoot().
| std::unique_ptr< SCHEMATIC > KI_TEST::LoadHierarchyFromRoot | ( | const std::string & | rootFilename, |
| PROJECT * | project ) |
Definition at line 105 of file schematic_file_util.cpp.
References LoadHierarchy(), project, and SCHEMATIC.
Referenced by LoadSchematic().
| void KI_TEST::LoadSchematic | ( | SETTINGS_MANAGER & | aSettingsManager, |
| const wxString & | aRelPath, | ||
| std::unique_ptr< SCHEMATIC > & | aSchematic ) |
Definition at line 125 of file schematic_file_util.cpp.
References SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_SCREENS::FixLegacyPowerSymbolMismatches(), GetEeschemaTestDataDir(), SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), PROJECT::LEGACY_SYMBOL_LIBS, LoadHierarchyFromRoot(), SETTINGS_MANAGER::LoadProject(), SETTINGS_MANAGER::Prj(), PROJECT::SetElem(), SETTINGS_MANAGER::UnloadProject(), SCH_SHEET_LIST::UpdateSheetInstanceData(), and SCH_SHEET_LIST::UpdateSymbolInstanceData().
Referenced by BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), ISSUE22864_FIXTURE::LoadSchematic(), and TEST_NETLIST_EXPORTER_FIXTURE< Exporter >::TestNetlist().
| void KI_TEST::LoadSheetSchematicContents | ( | const std::string & | fileName, |
| SCH_SHEET * | sheet ) |
Definition at line 47 of file schematic_file_util.cpp.
References SCH_IO_KICAD_SEXPR_PARSER::ParseSchematic(), and STDISTREAM_LINE_READER::SetStream().
Referenced by LoadHierarchy().
| void KI_TEST::PrintBoardStats | ( | const BOARD * | aBoard, |
| const std::string & | aBoardName ) |
Print detailed board statistics for debugging using test-framework logging.
Definition at line 741 of file board_test_utils.cpp.
References BOOST_TEST_MESSAGE(), BOARD::Footprints(), BOARD::GetCopperLayerCount(), BOARD::GetNetCount(), pad, PCB_ARC_T, PCB_TRACE_T, PCB_VIA_T, SMD, BOARD::Tracks(), and BOARD::Zones().
Referenced by BOOST_AUTO_TEST_CASE(), and RunBoardLoad().
| std::unique_ptr< BOARD > KI_TEST::ReadBoardFromFileOrStream | ( | const std::string & | aFilename, |
| std::istream & | aFallback = std::cin ) |
Read a board from a file, or another stream, as appropriate.
| aFilename | The file to read, or the fallback if empty |
| aFallback | the fallback stream |
Definition at line 94 of file board_file_utils.cpp.
References ReadItemFromStream().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_DATA_TEST_CASE_F(), LoadAndTestBoardFile(), LoadBoard(), loadKicadProject(), polygon_gererator_main(), polygon_triangulation_main(), and testSaveLoad().
| std::unique_ptr< BOARD_ITEM > KI_TEST::ReadBoardItemFromStream | ( | std::istream & | aStream | ) |
Utility function to read a BOARD_ITEM (probably a FOOTPRINT or a BOARD) from a file.
Helps when writing tests or utilities that can be fed an external file.
| aFilename | the file to read in |
Definition at line 72 of file board_file_utils.cpp.
References PCB_IO_KICAD_SEXPR_PARSER::Parse(), and STDISTREAM_LINE_READER::SetStream().
Referenced by ReadItemFromStream().
| std::unique_ptr< FOOTPRINT > KI_TEST::ReadFootprintFromFileOrStream | ( | const std::string & | aFilename, |
| std::istream & | aFallback ) |
Definition at line 121 of file board_file_utils.cpp.
References ReadItemFromStream().
Referenced by BOOST_AUTO_TEST_CASE(), and LoadAndTestFootprintFile().
| std::unique_ptr< ITEM > KI_TEST::ReadItemFromStream | ( | std::istream & | aStream | ) |
Read a specific kind of BOARD_ITEM from a stream.
| aStream | the stream to read from. |
Definition at line 83 of file board_file_utils.h.
References ITEM, and ReadBoardItemFromStream().
Referenced by ReadBoardFromFileOrStream(), and ReadFootprintFromFileOrStream().
| std::unique_ptr< SCHEMATIC > KI_TEST::ReadSchematicFromFile | ( | const std::string & | aFilename, |
| PROJECT * | aProject ) |
| std::unique_ptr< SCHEMATIC > KI_TEST::ReadSchematicFromStream | ( | std::istream & | aStream, |
| PROJECT * | aProject ) |
| BOARD_ITEM & KI_TEST::RequireBoardItemWithTypeAndId | ( | const BOARD & | aBoard, |
| KICAD_T | aItemType, | ||
| const KIID & | aID ) |
Get an item from the given board with a certain type and UUID.
If this doesn't exist, it's a BOOST_REQUIRE failure.
| aBoard | the board to look in |
| aItemType | the required item type |
| aID | the required |
Definition at line 191 of file board_test_utils.cpp.
References BOOST_REQUIRE(), BOARD::ResolveItem(), and EDA_ITEM::Type().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE(), BOOST_DATA_TEST_CASE_F(), and BOOST_FIXTURE_TEST_CASE().
|
extern |
Look up and run any additional ad-hoc tests for a block.
Note that these tests don't have context of the wider board, so they are necessarily limited to quite "static" checks of the block content.
Definition at line 121 of file test_block_additional.cpp.
References additionalBlockTests, BOOST_REQUIRE(), and BOOST_TEST_MESSAGE().
Referenced by ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest().
|
extern |
Look up and run any additional ad-hoc tests for a DB_OBJ (parsed and converted block)
Since most "useful" functionality probably should come from the resolved and invariant-assured DB_OBJ, these tests are probably more useful than binary-level block tests.
Definition at line 140 of file test_block_additional.cpp.
References additionalDbObjTests, BOOST_REQUIRE(), and BOOST_TEST_MESSAGE().
Referenced by ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest().
| void KI_TEST::SetMockConfigDir | ( | ) |
Definition at line 119 of file unit_test_utils.cpp.
References GetTestDataRootDir(), and path.
Referenced by fuzz_init(), and init_unit_test().
|
inline |
Predicate to check an SEXPR object converts to the expected string.
| aSexpr | s-expression |
| aExpStr | expected string |
Definition at line 209 of file sexpr_test_utils.h.
References SEXPR::SEXPR::AsString(), and BOOST_TEST_INFO().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Test predicate: is the s-expression a double?
Definition at line 163 of file sexpr_test_utils.h.
References IsSexprOfType(), and SEXPR::SEXPR_TYPE_ATOM_DOUBLE.
|
inline |
Test predicate: is the s-expression a double with the given value?
Definition at line 171 of file sexpr_test_utils.h.
References SEXPR::SEXPR::GetDouble(), IsSexprOfType(), IsSexprValueEqual(), and SEXPR::SEXPR_TYPE_ATOM_DOUBLE.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Test predicate: is the s-expression an integer?
Definition at line 146 of file sexpr_test_utils.h.
References IsSexprOfType(), and SEXPR::SEXPR_TYPE_ATOM_INTEGER.
|
inline |
Test predicate: is the s-expression an integer with the given value?
Definition at line 154 of file sexpr_test_utils.h.
References SEXPR::SEXPR::GetLongInteger(), IsSexprOfType(), IsSexprValueEqual(), and SEXPR::SEXPR_TYPE_ATOM_INTEGER.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Test predicate: is the s-expression a double?
Definition at line 180 of file sexpr_test_utils.h.
References IsSexprOfType(), and SEXPR::SEXPR_TYPE_LIST.
|
inline |
Test predicate: is the s-expression a list with the given length?
Definition at line 188 of file sexpr_test_utils.h.
References BOOST_TEST_MESSAGE(), SEXPR::SEXPR::GetNumberOfChildren(), IsSexprOfType(), and SEXPR::SEXPR_TYPE_LIST.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Test predicate: is the s-expression a string?
Definition at line 129 of file sexpr_test_utils.h.
References IsSexprOfType(), and SEXPR::SEXPR_TYPE_ATOM_STRING.
|
inline |
Test predicate: is the s-expression a string with the given value?
Definition at line 137 of file sexpr_test_utils.h.
References SEXPR::SEXPR::GetString(), IsSexprOfType(), IsSexprValueEqual(), and SEXPR::SEXPR_TYPE_ATOM_STRING.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Test predicate: is the s-expression a symbol?
Definition at line 112 of file sexpr_test_utils.h.
References IsSexprOfType(), and SEXPR::SEXPR_TYPE_ATOM_SYMBOL.
|
inline |
Test predicate: is the s-expression a symbol with the given value?
Definition at line 120 of file sexpr_test_utils.h.
References SEXPR::SEXPR::GetSymbol(), IsSexprOfType(), IsSexprValueEqual(), and SEXPR::SEXPR_TYPE_ATOM_SYMBOL.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 71 of file wx_assert.h.
Referenced by fuzz_init(), and init_unit_test().