KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_cadstar_archive_parser.cpp File Reference

Test suite for CADSTAR_ARCHIVE_PARSER. More...

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_CASEappendToChainCases
 

Detailed Description

Test suite for CADSTAR_ARCHIVE_PARSER.

Definition in file test_cadstar_archive_parser.cpp.

Typedef Documentation

◆ vt

Function Documentation

◆ AddCadstarAttributes()

static void AddCadstarAttributes ( XNODE * aNode,
const std::vector< wxString > & aValues )
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() [1/10]

◆ BOOST_AUTO_TEST_CASE() [2/10]

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() [3/10]

BOOST_AUTO_TEST_CASE ( CheckNoNextNodesWarnsInsteadOfThrowing )

◆ BOOST_AUTO_TEST_CASE() [4/10]

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() [5/10]

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() [6/10]

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() [7/10]

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() [8/10]

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() [9/10]

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() [10/10]

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.

Variable Documentation

◆ appendToChainCases

const std::vector<VERTEX_APPEND_CASE> appendToChainCases
static

Definition at line 54 of file test_cadstar_archive_parser.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ m_CadstarToKicadPointCallback

std::function<wxPoint( const wxPoint& )> m_CadstarToKicadPointCallback

Definition at line 49 of file test_cadstar_archive_parser.cpp.