|
KiCad PCB EDA Suite
|
Test suite for CADSTAR_ARCHIVE_PARSER. More...
#include <qa_utils/wx_utils/unit_test_utils.h>#include <common/io/cadstar/cadstar_archive_parser.h>#include <qa_utils/geometry/geometry.h>#include <geometry/shape_line_chain.h>#include <geometry/shape_arc.h>#include <wx/log.h>#include <ki_exception.h>#include <xnode.h>Go to the source code of this file.
Classes | |
| struct | VERTEX_APPEND_CASE |
Typedefs | |
| using | vt = CADSTAR_ARCHIVE_PARSER::VERTEX_TYPE |
Functions | |
| BOOST_AUTO_TEST_CASE (AppendToChain) | |
| BOOST_AUTO_TEST_CASE (ParseChildErrorContext) | |
| A malformed child node deep in the archive must surface an error that identifies the enclosing section, not just the leaf node, so the failure can be located in a large design. | |
| static void | AddCadstarAttributes (XNODE *aNode, const std::vector< wxString > &aValues) |
| Helper to add "attr0", "attr1", ... attributes to an XNODE, matching the format used by the CADSTAR S-expression parser. | |
| BOOST_AUTO_TEST_CASE (UnknownNodeInHeaderDoesNotThrow) | |
| Build a minimal HEADER node tree with a known child node and an unknown child node. | |
| BOOST_AUTO_TEST_CASE (UnknownNodeInRouteCodeDoesNotThrow) | |
| Build a minimal ROUTECODE node tree with an unknown child node. | |
| BOOST_AUTO_TEST_CASE (UnknownAlignmentReturnsDefault) | |
| Verify that unknown parameters in enum-like parsers (e.g. | |
| BOOST_AUTO_TEST_CASE (UnknownReadabilityReturnsDefault) | |
| Verify that unknown readability parameter returns a sensible default. | |
| BOOST_AUTO_TEST_CASE (CheckNoChildNodesWarnsInsteadOfThrowing) | |
| Verify that CheckNoChildNodes and CheckNoNextNodes warn rather than throw when unexpected nodes are present. | |
| BOOST_AUTO_TEST_CASE (CheckNoNextNodesWarnsInsteadOfThrowing) | |
| BOOST_AUTO_TEST_CASE (UnknownUnitsReturnsDefault) | |
| Verify that unknown units parameter returns DESIGN as a default. | |
| BOOST_AUTO_TEST_CASE (UnknownPinTypeReturnsDefault) | |
| Verify that unknown pin type returns UNCOMMITTED as a default. | |
Variables | |
| std::function< wxPoint(const wxPoint &)> | m_CadstarToKicadPointCallback |
| static const std::vector< VERTEX_APPEND_CASE > | appendToChainCases |
Test suite for CADSTAR_ARCHIVE_PARSER.
Definition in file test_cadstar_archive_parser.cpp.
Definition at line 51 of file test_cadstar_archive_parser.cpp.
|
static |
Helper to add "attr0", "attr1", ... attributes to an XNODE, matching the format used by the CADSTAR S-expression parser.
Definition at line 172 of file test_cadstar_archive_parser.cpp.
References XNODE::AddAttribute().
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().
| BOOST_AUTO_TEST_CASE | ( | AppendToChain | ) |
Definition at line 96 of file test_cadstar_archive_parser.cpp.
References appendToChainCases, BOOST_CHECK_PREDICATE(), chain, BOX2< Vec >::GetPosition(), BOX2< Vec >::GetSize(), KI_TEST::IsVecWithinTol(), BOX2< Vec >::Normalize(), SCH_IU_PER_MM, BOX2< Vec >::SetOrigin(), and BOX2< Vec >::SetSize().
| BOOST_AUTO_TEST_CASE | ( | CheckNoChildNodesWarnsInsteadOfThrowing | ) |
Verify that CheckNoChildNodes and CheckNoNextNodes warn rather than throw when unexpected nodes are present.
Definition at line 278 of file test_cadstar_archive_parser.cpp.
References CADSTAR_ARCHIVE_PARSER::CheckNoChildNodes().
| BOOST_AUTO_TEST_CASE | ( | CheckNoNextNodesWarnsInsteadOfThrowing | ) |
Definition at line 290 of file test_cadstar_archive_parser.cpp.
References CADSTAR_ARCHIVE_PARSER::CheckNoNextNodes().
| BOOST_AUTO_TEST_CASE | ( | ParseChildErrorContext | ) |
A malformed child node deep in the archive must surface an error that identifies the enclosing section, not just the leaf node, so the failure can be located in a large design.
Definition at line 150 of file test_cadstar_archive_parser.cpp.
References CADSTAR_ARCHIVE_PARSER::ParseAllChildPoints().
| BOOST_AUTO_TEST_CASE | ( | UnknownAlignmentReturnsDefault | ) |
Verify that unknown parameters in enum-like parsers (e.g.
ParseAlignment) return a sensible default rather than throwing.
Definition at line 241 of file test_cadstar_archive_parser.cpp.
References AddCadstarAttributes(), BOOST_CHECK_EQUAL(), CADSTAR_ARCHIVE_PARSER::NO_ALIGNMENT, CADSTAR_ARCHIVE_PARSER::ParseAlignment(), and result.
| BOOST_AUTO_TEST_CASE | ( | UnknownNodeInHeaderDoesNotThrow | ) |
Build a minimal HEADER node tree with a known child node and an unknown child node.
Verifies that the unknown node is gracefully skipped (no exception thrown).
Definition at line 189 of file test_cadstar_archive_parser.cpp.
References AddCadstarAttributes(), BOOST_CHECK_EQUAL(), formatNode(), and header.
| BOOST_AUTO_TEST_CASE | ( | UnknownNodeInRouteCodeDoesNotThrow | ) |
Build a minimal ROUTECODE node tree with an unknown child node.
Verifies that the unknown node is skipped and known children still parse correctly.
Definition at line 214 of file test_cadstar_archive_parser.cpp.
References AddCadstarAttributes(), BOOST_CHECK_EQUAL(), CADSTAR_ARCHIVE_PARSER::ROUTECODE::ID, CADSTAR_ARCHIVE_PARSER::ROUTECODE::NeckedWidth, and CADSTAR_ARCHIVE_PARSER::ROUTECODE::Parse().
| BOOST_AUTO_TEST_CASE | ( | UnknownPinTypeReturnsDefault | ) |
Verify that unknown pin type returns UNCOMMITTED as a default.
Definition at line 325 of file test_cadstar_archive_parser.cpp.
References AddCadstarAttributes(), BOOST_CHECK_EQUAL(), CADSTAR_ARCHIVE_PARSER::PART::GetPinType(), result, and UNCOMMITTED.
| BOOST_AUTO_TEST_CASE | ( | UnknownReadabilityReturnsDefault | ) |
Verify that unknown readability parameter returns a sensible default.
Definition at line 259 of file test_cadstar_archive_parser.cpp.
References AddCadstarAttributes(), BOOST_CHECK_EQUAL(), CADSTAR_ARCHIVE_PARSER::BOTTOM_TO_TOP, CADSTAR_ARCHIVE_PARSER::ParseReadability(), and result.
| BOOST_AUTO_TEST_CASE | ( | UnknownUnitsReturnsDefault | ) |
Verify that unknown units parameter returns DESIGN as a default.
Definition at line 307 of file test_cadstar_archive_parser.cpp.
References AddCadstarAttributes(), BOOST_CHECK_EQUAL(), CADSTAR_ARCHIVE_PARSER::DESIGN, CADSTAR_ARCHIVE_PARSER::ParseUnits(), and result.
|
static |
Definition at line 54 of file test_cadstar_archive_parser.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
| std::function<wxPoint( const wxPoint& )> m_CadstarToKicadPointCallback |
Definition at line 49 of file test_cadstar_archive_parser.cpp.