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

Benchmark tests for DipTrace pad import accuracy. More...

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (TotalPadCount)
 Verify that the Z80 board produces a substantial pad count.
 
 BOOST_AUTO_TEST_CASE (MultiPinFootprints)
 Verify that multi-pin IC footprints have the expected number of pads.
 
 BOOST_AUTO_TEST_CASE (PadDimensionsReasonable)
 Verify that pad dimensions are within reasonable physical bounds.
 
 BOOST_AUTO_TEST_CASE (DipPinSpacing)
 Verify DIP pin spacing for multi-pin IC footprints.
 
 BOOST_AUTO_TEST_CASE (PadNetAssignment)
 Verify that at least some pads have non-zero net assignments.
 
 BOOST_AUTO_TEST_CASE (KnownNetsOnPads)
 Verify that specific well-known nets are assigned to pads.
 
 BOOST_AUTO_TEST_CASE (CrossVersionPadConsistency)
 Cross-file consistency: verify that pad parsing produces consistent results across different DipTrace format versions.
 
 BOOST_AUTO_TEST_CASE (TrackSegmentCounts)
 Verify that track segments are imported with expected counts.
 
 BOOST_AUTO_TEST_CASE (ViaCounts)
 Verify that vias are imported on boards that should have them.
 
 BOOST_AUTO_TEST_CASE (TrackAndViaDimensionsReasonable)
 Verify track widths and via dimensions are physically reasonable.
 
 BOOST_AUTO_TEST_CASE (TrackNetAssignment)
 Verify that tracks carry valid net assignments.
 
 BOOST_AUTO_TEST_CASE (ZoneCounts)
 Verify that copper zones are imported with expected counts per board.
 
 BOOST_AUTO_TEST_CASE (ZoneNetAssignment)
 Verify that zones carry valid net assignments.
 
 BOOST_AUTO_TEST_CASE (ZoneOutlineDimensions)
 Verify that zone outlines have reasonable vertex counts and physical dimensions.
 
 BOOST_AUTO_TEST_CASE (ZoneLayerAssignment)
 Verify that zones are assigned to valid copper layers.
 
 BOOST_AUTO_TEST_CASE (FootprintGraphics)
 Verify that footprint graphics (silkscreen outlines) are imported.
 
 BOOST_AUTO_TEST_CASE (FootprintGraphicsDimensions)
 Verify that footprint outline dimensions are physically reasonable.
 
 BOOST_AUTO_TEST_CASE (EdgeCutsOutlineConnectivity)
 Every imported Edge.Cuts endpoint should connect to another Edge.Cuts endpoint.
 
 BOOST_AUTO_TEST_CASE (TraceEndpointConnectivity)
 Trace endpoints should attach to at least one additional anchor on the same net (another trace endpoint, a via, or a pad).
 
 BOOST_AUTO_TEST_CASE (Smd0805PadSanity)
 Sanity-check imported 0805 packages: they should be 2-pad SMD footprints with reasonable rectangular/rounded pad shapes and dimensions.
 
 BOOST_AUTO_TEST_CASE (ImportedViasDoNotShortDifferentNets)
 
 BOOST_AUTO_TEST_CASE (FootprintPadsInsideBoardOutline)
 
 BOOST_AUTO_TEST_CASE (ViewerExamplesOptional)
 
 BOOST_AUTO_TEST_CASE (ViewerExamplesDipXmlParityOptional)
 
 BOOST_AUTO_TEST_CASE (ViewerExamplesViaParityOptional)
 
 BOOST_AUTO_TEST_CASE (ExternalCorpusImportOptional)
 Optional local-corpus sweep.
 
 BOOST_AUTO_TEST_CASE (ZoneDesignRulesValid)
 Generated custom DRC rules for per-zone DipTrace properties must always parse cleanly through KiCad's own rules parser.
 
 BOOST_AUTO_TEST_CASE (ZoneDesignRulesParityOptional)
 Parity check for the generated zone DRC rules against known DipTrace viewer data.
 
 BOOST_AUTO_TEST_CASE (PlacementRotationAngles)
 The exact placement rotation of every component lives in a dedicated placement section, stored as a biased int4 of radians x 1e4.
 

Detailed Description

Benchmark tests for DipTrace pad import accuracy.

These tests encode what correct pad import should look like: reasonable dimensions, correct pin spacing for known packages, and pad-to-net assignment. Tests that currently fail represent known gaps to be closed.

Definition in file test_diptrace_benchmarks.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/29]

BOOST_AUTO_TEST_CASE ( CrossVersionPadConsistency )

Cross-file consistency: verify that pad parsing produces consistent results across different DipTrace format versions.

Definition at line 1036 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE().

◆ BOOST_AUTO_TEST_CASE() [2/29]

BOOST_AUTO_TEST_CASE ( DipPinSpacing )

Verify DIP pin spacing for multi-pin IC footprints.

In a DIP package, adjacent pins on the same side are spaced 2.54mm (100 mil). Find footprints with many pads, sort by position, and check adjacent spacing.

Definition at line 914 of file test_diptrace_benchmarks.cpp.

References std::abs(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), pad, and pcbIUScale.

◆ BOOST_AUTO_TEST_CASE() [3/29]

BOOST_AUTO_TEST_CASE ( EdgeCutsOutlineConnectivity )

Every imported Edge.Cuts endpoint should connect to another Edge.Cuts endpoint.

This validates that the board outline is contiguous and does not contain open ends.

Definition at line 1458 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE().

◆ BOOST_AUTO_TEST_CASE() [4/29]

BOOST_AUTO_TEST_CASE ( ExternalCorpusImportOptional )

Optional local-corpus sweep.

Enable by setting DIPTRACE_EXTERNAL_CORPUS_DIR to a directory containing .dip files.

Definition at line 2665 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_TEST_MESSAGE(), path, IO_ERROR::What(), and IO_ERROR::what().

◆ BOOST_AUTO_TEST_CASE() [5/29]

BOOST_AUTO_TEST_CASE ( FootprintGraphics )

Verify that footprint graphics (silkscreen outlines) are imported.

DIP and axial packages should have outline shapes on their footprints.

Definition at line 1354 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), and PCB_SHAPE_T.

◆ BOOST_AUTO_TEST_CASE() [6/29]

BOOST_AUTO_TEST_CASE ( FootprintGraphicsDimensions )

Verify that footprint outline dimensions are physically reasonable.

The bounding box of footprint graphics should be larger than the pad extent or at least comparable in size.

Definition at line 1391 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), PCB_SHAPE::GetBoundingBox(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Merge(), PCB_SHAPE_T, and pcbIUScale.

◆ BOOST_AUTO_TEST_CASE() [7/29]

BOOST_AUTO_TEST_CASE ( FootprintPadsInsideBoardOutline )

◆ BOOST_AUTO_TEST_CASE() [8/29]

BOOST_AUTO_TEST_CASE ( ImportedViasDoNotShortDifferentNets )

Definition at line 1598 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), and BOOST_TEST_MESSAGE().

◆ BOOST_AUTO_TEST_CASE() [9/29]

BOOST_AUTO_TEST_CASE ( KnownNetsOnPads )

Verify that specific well-known nets are assigned to pads.

GND, VCC/+5V, and bus signals like A0 and D0 should appear on pad net lists.

Definition at line 1008 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), and pad.

◆ BOOST_AUTO_TEST_CASE() [10/29]

BOOST_AUTO_TEST_CASE ( MultiPinFootprints )

Verify that multi-pin IC footprints have the expected number of pads.

The Z80 board should have at least one footprint with >= 14 pads (DIP-14) and ideally one with ~40 pads (the Z80 CPU itself).

Definition at line 831 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), and BOOST_REQUIRE().

◆ BOOST_AUTO_TEST_CASE() [11/29]

BOOST_AUTO_TEST_CASE ( PadDimensionsReasonable )

Verify that pad dimensions are within reasonable physical bounds.

Through-hole pads are typically 1.0-3.0mm diameter. SMD pads range from 0.2mm to ~5mm. A board full of through-hole ICs should have most pads > 0.8mm.

Definition at line 866 of file test_diptrace_benchmarks.cpp.

References PADSTACK::ALL_LAYERS, BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), pad, pcbIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [12/29]

BOOST_AUTO_TEST_CASE ( PadNetAssignment )

Verify that at least some pads have non-zero net assignments.

After proper import, pads connected to nets should carry their net code.

Definition at line 973 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), and pad.

◆ BOOST_AUTO_TEST_CASE() [13/29]

BOOST_AUTO_TEST_CASE ( PlacementRotationAngles )

The exact placement rotation of every component lives in a dedicated placement section, stored as a biased int4 of radians x 1e4.

These two fixtures each hold four identical capacitors rotated to known angles, so the importer must reproduce each cardinal AND each arbitrary angle exactly (not snapped to 90 degrees). rotate.dip is a v60 file and rotate4.dip a v54 file, proving the encoding is version-independent.

Definition at line 2863 of file test_diptrace_benchmarks.cpp.

References std::abs(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), and expected.

◆ BOOST_AUTO_TEST_CASE() [14/29]

BOOST_AUTO_TEST_CASE ( Smd0805PadSanity )

Sanity-check imported 0805 packages: they should be 2-pad SMD footprints with reasonable rectangular/rounded pad shapes and dimensions.

Definition at line 1516 of file test_diptrace_benchmarks.cpp.

References PADSTACK::ALL_LAYERS, BOOST_CHECK_MESSAGE(), pad, pcbIUScale, SMD, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [15/29]

BOOST_AUTO_TEST_CASE ( TotalPadCount )

Verify that the Z80 board produces a substantial pad count.

The footprints (ICs averaging 14-40 pins and discretes at 2 pins) yield well over 400 pads. Standalone Static Via components are imported as vias rather than single-pad footprints, so they no longer contribute to this count (observed 480 footprint pads after that fix).

Definition at line 812 of file test_diptrace_benchmarks.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_MESSAGE(), and BOOST_REQUIRE().

◆ BOOST_AUTO_TEST_CASE() [16/29]

BOOST_AUTO_TEST_CASE ( TraceEndpointConnectivity )

Trace endpoints should attach to at least one additional anchor on the same net (another trace endpoint, a via, or a pad).

This catches broken chain linking.

Definition at line 1485 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE().

◆ BOOST_AUTO_TEST_CASE() [17/29]

BOOST_AUTO_TEST_CASE ( TrackAndViaDimensionsReasonable )

Verify track widths and via dimensions are physically reasonable.

Track widths should be 0.1-3.0mm for typical PCBs. Via diameters should be 0.3-2.0mm.

Definition at line 1152 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), F_Cu, PCB_TRACE_T, PCB_VIA_T, pcbIUScale, and via.

◆ BOOST_AUTO_TEST_CASE() [18/29]

BOOST_AUTO_TEST_CASE ( TrackNetAssignment )

Verify that tracks carry valid net assignments.

All tracks in a properly imported board should have net codes > 0.

Definition at line 1205 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), and PCB_TRACE_T.

◆ BOOST_AUTO_TEST_CASE() [19/29]

BOOST_AUTO_TEST_CASE ( TrackSegmentCounts )

Verify that track segments are imported with expected counts.

The Z80 board is a heavily routed 2-layer design and should have over 1000 track segments.

Definition at line 1071 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), and PCB_TRACE_T.

◆ BOOST_AUTO_TEST_CASE() [20/29]

BOOST_AUTO_TEST_CASE ( ViaCounts )

Verify that vias are imported on boards that should have them.

The Z80 board uses many vias for layer transitions; simpler boards may have none.

Definition at line 1108 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), and PCB_VIA_T.

◆ BOOST_AUTO_TEST_CASE() [21/29]

◆ BOOST_AUTO_TEST_CASE() [22/29]

◆ BOOST_AUTO_TEST_CASE() [23/29]

BOOST_AUTO_TEST_CASE ( ViewerExamplesViaParityOptional )

◆ BOOST_AUTO_TEST_CASE() [24/29]

BOOST_AUTO_TEST_CASE ( ZoneCounts )

Verify that copper zones are imported with expected counts per board.

Definition at line 1244 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), and expected.

◆ BOOST_AUTO_TEST_CASE() [25/29]

BOOST_AUTO_TEST_CASE ( ZoneDesignRulesParityOptional )

Parity check for the generated zone DRC rules against known DipTrace viewer data.

CNC_controller pours all carry BoardClearance=0.66mm and ViaDirect=Y, so the generated file must contain a 0.66mm edge_clearance rule and solid via zone_connection rules.

Definition at line 2809 of file test_diptrace_benchmarks.cpp.

References std::abs(), BOOST_CHECK_MESSAGE(), BOOST_TEST_MESSAGE(), EDGE_CLEARANCE_CONSTRAINT, FULL, DIPTRACE::PCB_PARSER::GenerateDesignRules(), DRC_CONSTRAINT::GetValue(), DRC_CONSTRAINT::m_Type, DRC_CONSTRAINT::m_ZoneConnection, MINOPTMAX< T >::Min(), DIPTRACE::PCB_PARSER::Parse(), DRC_RULES_PARSER::Parse(), pcbIUScale, reporter, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and ZONE_CONNECTION_CONSTRAINT.

◆ BOOST_AUTO_TEST_CASE() [26/29]

BOOST_AUTO_TEST_CASE ( ZoneDesignRulesValid )

Generated custom DRC rules for per-zone DipTrace properties must always parse cleanly through KiCad's own rules parser.

Run against a committed board so the syntax is validated on every build.

Definition at line 2765 of file test_diptrace_benchmarks.cpp.

References boards, BOOST_CHECK_MESSAGE(), DIPTRACE::PCB_PARSER::GenerateDesignRules(), name, DIPTRACE::PCB_PARSER::Parse(), DRC_RULES_PARSER::Parse(), reporter, RPT_SEVERITY_ERROR, and RPT_SEVERITY_WARNING.

◆ BOOST_AUTO_TEST_CASE() [27/29]

BOOST_AUTO_TEST_CASE ( ZoneLayerAssignment )

Verify that zones are assigned to valid copper layers.

Definition at line 1335 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), and IsCopperLayer().

◆ BOOST_AUTO_TEST_CASE() [28/29]

BOOST_AUTO_TEST_CASE ( ZoneNetAssignment )

Verify that zones carry valid net assignments.

GND pour zones should reference the GND net.

Definition at line 1274 of file test_diptrace_benchmarks.cpp.

References BOOST_CHECK_MESSAGE(), and BOOST_REQUIRE().

◆ BOOST_AUTO_TEST_CASE() [29/29]

BOOST_AUTO_TEST_CASE ( ZoneOutlineDimensions )

Verify that zone outlines have reasonable vertex counts and physical dimensions.

A simple rectangular pour has 4+ vertices; complex board-edge-following pours have more. Zone extent should be at least a few mm in both directions.

Definition at line 1304 of file test_diptrace_benchmarks.cpp.

References SHAPE_POLY_SET::BBox(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), SHAPE_POLY_SET::COutline(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), pcbIUScale, and SHAPE_LINE_CHAIN::PointCount().