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

Test suite for import of Cadence Allegro PCB .brd files. More...

#include "allegro_test_utils.h"
#include <pcbnew_utils/board_test_utils.h>
#include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/pcb_io/allegro/pcb_io_allegro.h>
#include <board.h>
#include <footprint.h>
#include <pad.h>
#include <pcb_shape.h>
#include <pcb_text.h>
#include <pcb_track.h>
#include <zone.h>
#include <netinfo.h>
#include <netclass.h>
#include <board_design_settings.h>
#include <project/net_settings.h>
#include <reporter.h>
#include <filesystem>
#include <fstream>
#include <map>
#include <set>

Go to the source code of this file.

Classes

struct  ALLEGRO_IMPORT_FIXTURE
 
struct  ALLEGRO_BOARD_TEST_CASE
 Data for parameterized all-boards test. More...
 
struct  ALLEGRO_COMPREHENSIVE_FIXTURE
 Fixture for comprehensive board import tests with error capturing. More...
 
struct  ALG_ZONE_POLYGON
 Parse a FabMaster .alg file and extract reference data for cross-validation. More...
 
struct  ALG_REFERENCE_DATA
 
struct  BRD_ALG_PAIR
 
struct  ALG_OUTLINE_DATA
 Parse board outline geometry from a .alg ASCII reference file. More...
 
struct  ALG_OUTLINE_DATA::OUTLINE_SEGMENT
 

Functions

 BOOST_AUTO_TEST_CASE (FootprintRefDes)
 Test that footprints have valid reference designators.
 
 BOOST_AUTO_TEST_CASE (PadSizes)
 Test that pads have valid sizes and are not degenerate.
 
 BOOST_AUTO_TEST_CASE (ViaSizes)
 Test that vias have valid sizes (not hardcoded fallback values).
 
 BOOST_AUTO_TEST_CASE (TrackWidths)
 Test that track widths are reasonable.
 
 BOOST_AUTO_TEST_CASE (PadNumbers)
 Test that pad numbers are set correctly.
 
 BOOST_AUTO_TEST_CASE (BoardOutline)
 Test that board outline is imported correctly.
 
 BOOST_AUTO_TEST_CASE (PadsInsideOutline)
 Test that all pads are inside the board outline.
 
 BOOST_AUTO_TEST_CASE (PreV16FileRejection)
 Verify that pre-v16 Allegro files are rejected with an informative error message rather than an opaque "Unknown Allegro file version" error.
 
 BOOST_AUTO_TEST_CASE (RectsZoneVsCopperPolygon)
 Test that rects.brd imports one zone fill (left rectangle) and one standalone copper polygon with a net (right rectangle).
 
 BOOST_AUTO_TEST_CASE (CopperText)
 Test that copper_text.brd imports the "TESTING" text on F.Cu.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_OutermostZoneNets)
 Verify that the outermost (largest area) zone on each copper layer of BeagleBone Black is assigned the GND_EARTH net.
 
 BOOST_AUTO_TEST_CASE (PadSizesPositive)
 Verify that all pads have positive sizes (no negative dimensions).
 
 BOOST_AUTO_TEST_CASE (ViaDrillNotLargerThanSize)
 Verify that via drill sizes are not larger than via diameters.
 
 BOOST_AUTO_TEST_CASE (SmdPadDetection)
 Verify that pads with no drill hole are properly marked as SMD.
 
 BOOST_AUTO_TEST_CASE (QuadPackagePadRotation)
 Verify that pads on quad flat packages (QFN/QFP) have proper rotation.
 
 BOOST_AUTO_TEST_CASE (FootprintLayerPlacement)
 Verify that footprints are placed on the correct layer.
 
 BOOST_AUTO_TEST_CASE (ArcConnectivity)
 Verify that arc start points connect to adjacent track endpoints.
 
static std::vector< BRD_ALG_PAIRgetBoardsWithAlg ()
 Get a list of all board files in the test data that have a corresponding .alg reference file.
 
 BOOST_AUTO_TEST_CASE (AlgReferenceNetNames)
 Cross-validate imported board net names against .alg ASCII reference export.
 
 BOOST_AUTO_TEST_CASE (AlgReferenceComponentPlacement)
 Cross-validate imported board component reference designators against .alg reference.
 
 BOOST_AUTO_TEST_CASE (AllTracksPositiveWidth)
 Verify that all tracks and arcs have positive width across all boards.
 
 BOOST_AUTO_TEST_CASE (OutlineSegmentCount)
 Compare board outline segment count from binary import against .alg reference.
 
 BOOST_AUTO_TEST_CASE (OutlineBoundingBox)
 Compare board bounding box from binary import against .alg outline coordinates.
 
 BOOST_AUTO_TEST_CASE (OutlineEndpoints)
 For boards with line-only outlines, verify each segment endpoint matches the .alg reference within tolerance.
 
 BOOST_AUTO_TEST_CASE (PadDrillConsistency)
 Verify PTH pads have nonzero drill and SMD pads have zero drill across all boards.
 
 BOOST_AUTO_TEST_CASE (ZoneCountMatchesAlg)
 Cross-validate the number of copper zones against .alg ETCH SHAPE records.
 
 BOOST_AUTO_TEST_CASE (ZoneLayerDistribution)
 Cross-validate how many zones appear on each copper layer.
 
 BOOST_AUTO_TEST_CASE (ZoneBoundingBoxes)
 Cross-validate zone bounding box sizes between binary import and .alg reference.
 
 BOOST_AUTO_TEST_CASE (PadContainedInFabOutline)
 Verify that footprint pads are contained within their F.Fab outline bounding box.
 
 BOOST_AUTO_TEST_CASE (PadOrientationP6P10)
 Verify pad orientation on footprints P6 and P10.
 
 BOOST_AUTO_TEST_CASE (SlotHoles)
 Verify that oblong (slot) drill holes are imported with the correct shape and dimensions.
 
 BOOST_AUTO_TEST_CASE (FootprintOrientation)
 Verify that footprint J1 in BeagleBone_Black_RevC imports at 180 degrees orientation.
 
 BOOST_AUTO_TEST_CASE (NetclassTraceWidths)
 Verify that per-net trace width constraints from Allegro FIELD blocks are imported as KiCad netclass track width settings.
 
 BOOST_AUTO_TEST_CASE (DiffPairNetclass)
 Verify that diff pair match groups in BeagleBone Black produce netclasses with the DP_ prefix and contain exactly 2 nets each.
 
 BOOST_AUTO_TEST_CASE (MatchGroupNetclass)
 Verify that match groups with more than 2 nets (DDR byte lanes, address buses) produce netclasses with the MG_ prefix.
 
 BOOST_AUTO_TEST_CASE (MatchGroupCounts)
 Verify the total number of match group netclasses across all boards that have them.
 
 BOOST_AUTO_TEST_CASE (NoMatchGroupsOnSimpleBoard)
 Verify that boards without match groups (e.g., simple boards) don't produce any DP_ or MG_ netclasses.
 
 BOOST_AUTO_TEST_CASE (ConstraintSetNetclasses)
 Verify that physical constraint sets (0x1D blocks) from BeagleBone Black are imported as KiCad netclasses with correct track width and clearance values.
 
 BOOST_AUTO_TEST_CASE (ConstraintSetPreV172)
 Verify constraint set import on a pre-V172 board (TRS80_POWER).
 
 BOOST_AUTO_TEST_CASE (ConstraintSetAndTraceWidth)
 Verify that constraint set netclasses and per-net trace width netclasses coexist.
 
 BOOST_AUTO_TEST_CASE (ConstraintSetDiffPairGap)
 Verify diff pair gap is imported from f[7] of constraint set DataB records.
 
 BOOST_AUTO_TEST_CASE (ConstraintSetDiffPairGapPreV172)
 Verify diff pair gap is imported on pre-V172 boards.
 
 BOOST_AUTO_TEST_CASE (UIImportPath_NullBoard)
 Test that LoadBoard works when aAppendToMe is nullptr, which is the path used by the KiCad UI "Import Non-KiCad Board" flow.
 
 BOOST_AUTO_TEST_CASE (SmdPadLayerConsistency)
 Verify that SMD pad layer sets are consistent with their parent footprint side.
 
 BOOST_AUTO_TEST_CASE (SmdFootprintTechLayers)
 Verify that SMD-only footprint tech layers are consistent with the footprint side.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_DrillSlotOrientation)
 Verify that oblong drill slots on BeagleBone connectors align with their copper pad orientation.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_ZoneFills)
 Verify that zones on BeagleBone have fill polygons imported from Allegro's computed copper.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_Teardrops)
 Verify that Allegro dynamic copper shapes (m_Unknown2 bit 12) are imported as teardrop zones, and that the pads/vias anchoring those teardrops have teardrops enabled.
 
 BOOST_AUTO_TEST_CASE (PreV172_NoTeardrops)
 Verify that pre-V172 boards (which lack the m_Unknown2 discriminator field) have no teardrop zones and no pads/vias with teardrops enabled.
 
 BOOST_AUTO_TEST_CASE (LegacyNetclassFlags)
 Verify that the importer sets the legacy netclass and design settings flags so that netclasses survive the SetProject() call during UI import (which replaces m_NetSettings with the project's version unless these flags are set).
 
 BOOST_AUTO_TEST_CASE (NetclassesCreatedForAllBoards)
 Verify that netclasses with correct DRC values are created for every board that has constraint sets.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_NetclassAssignments)
 Verify that BeagleBone Black netclass net assignments survive and that assigned nets have the correct netclass.
 

Detailed Description

Test suite for import of Cadence Allegro PCB .brd files.

Definition in file test_allegro_import.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/51]

BOOST_AUTO_TEST_CASE ( AlgReferenceComponentPlacement )

Cross-validate imported board component reference designators against .alg reference.

Definition at line 1381 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), getBoardsWithAlg(), ALG_REFERENCE_DATA::ParseAlgFile(), and ALG_REFERENCE_DATA::refDes.

◆ BOOST_AUTO_TEST_CASE() [2/51]

BOOST_AUTO_TEST_CASE ( AlgReferenceNetNames )

Cross-validate imported board net names against .alg ASCII reference export.

Definition at line 1333 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), getBoardsWithAlg(), BOARD::GetNetInfo(), ALG_REFERENCE_DATA::netNames, and ALG_REFERENCE_DATA::ParseAlgFile().

◆ BOOST_AUTO_TEST_CASE() [3/51]

BOOST_AUTO_TEST_CASE ( AllTracksPositiveWidth )

Verify that all tracks and arcs have positive width across all boards.

Definition at line 1440 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), PCB_ARC_T, PCB_TRACE_T, and BOARD::Tracks().

◆ BOOST_AUTO_TEST_CASE() [4/51]

BOOST_AUTO_TEST_CASE ( ArcConnectivity )

Verify that arc start points connect to adjacent track endpoints.

This checks that arc orientation/winding is correct.

Definition at line 955 of file test_allegro_import.cpp.

References BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), PCB_TRACK::GetEnd(), BOARD_CONNECTED_ITEM::GetNetCode(), PCB_TRACK::GetStart(), pad, PCB_ARC_T, PCB_TRACE_T, PCB_VIA_T, BOARD::Tracks(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [5/51]

BOOST_AUTO_TEST_CASE ( BeagleBone_DrillSlotOrientation )

Verify that oblong drill slots on BeagleBone connectors align with their copper pad orientation.

P6 pads 20/21, P3 pad 6, and P1 pads 1-3 have vertical oblong pads that require vertical slots. Previously the slot dimensions were imported as (primary, secondary) instead of matching the pad aspect ratio, producing horizontal slots on vertical pads.

Definition at line 2933 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), F_Cu, BOARD::Footprints(), pad, FOOTPRINT::Pads(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [6/51]

BOOST_AUTO_TEST_CASE ( BeagleBone_NetclassAssignments )

Verify that BeagleBone Black netclass net assignments survive and that assigned nets have the correct netclass.

This tests the full pattern+direct assignment chain.

Definition at line 3217 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), clearance, NETCLASS::Default, expected, BOARD::GetDesignSettings(), NETCLASS::GetName(), BOARD::GetNetInfo(), BOARD_DESIGN_SETTINGS::m_NetSettings, and name.

◆ BOOST_AUTO_TEST_CASE() [7/51]

BOOST_AUTO_TEST_CASE ( BeagleBone_OutermostZoneNets )

Verify that the outermost (largest area) zone on each copper layer of BeagleBone Black is assigned the GND_EARTH net.

Allegro stores these as BOUNDARY shapes with net pointers resolved through the Ptr7 -> 0x2C TABLE -> 0x37 -> 0x1B NET chain.

Definition at line 585 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOX2< Vec >::GetHeight(), BOARD::GetLayerID(), BOARD_CONNECTED_ITEM::GetNetname(), BOX2< Vec >::GetWidth(), UNDEFINED_LAYER, and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [8/51]

BOOST_AUTO_TEST_CASE ( BeagleBone_Teardrops )

Verify that Allegro dynamic copper shapes (m_Unknown2 bit 12) are imported as teardrop zones, and that the pads/vias anchoring those teardrops have teardrops enabled.

Definition at line 3050 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), pad, PCB_VIA_T, BOARD::Tracks(), and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [9/51]

BOOST_AUTO_TEST_CASE ( BeagleBone_ZoneFills )

Verify that zones on BeagleBone have fill polygons imported from Allegro's computed copper.

The GND_EARTH zones should have non-empty fill polygon data.

Definition at line 3012 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [10/51]

BOOST_AUTO_TEST_CASE ( BoardOutline )

Test that board outline is imported correctly.

Definition at line 265 of file test_allegro_import.cpp.

References BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), Edge_Cuts, end, and PCB_SHAPE_T.

◆ BOOST_AUTO_TEST_CASE() [11/51]

BOOST_AUTO_TEST_CASE ( ConstraintSetAndTraceWidth )

Verify that constraint set netclasses and per-net trace width netclasses coexist.

ProiectBoard has both a constraint set (CS_0) and per-net trace widths (W20mil, W24mil).

Definition at line 2657 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [12/51]

BOOST_AUTO_TEST_CASE ( ConstraintSetDiffPairGap )

Verify diff pair gap is imported from f[7] of constraint set DataB records.

BeagleBone_Black_RevC is V172+ (divisor=100) with two DIFF constraint sets.

Definition at line 2695 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [13/51]

BOOST_AUTO_TEST_CASE ( ConstraintSetDiffPairGapPreV172 )

Verify diff pair gap is imported on pre-V172 boards.

VCU118 (divisor=1000) has multiple diff pair constraint sets with per-layer variation in f[7].

Definition at line 2732 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [14/51]

BOOST_AUTO_TEST_CASE ( ConstraintSetNetclasses )

Verify that physical constraint sets (0x1D blocks) from BeagleBone Black are imported as KiCad netclasses with correct track width and clearance values.

Definition at line 2577 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), NETCLASS::GetName(), BOARD::GetNetInfo(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [15/51]

BOOST_AUTO_TEST_CASE ( ConstraintSetPreV172 )

Verify constraint set import on a pre-V172 board (TRS80_POWER).

Pre-V172 boards have no dedicated clearance field, so spacing is used as the clearance fallback.

Definition at line 2632 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [16/51]

BOOST_AUTO_TEST_CASE ( CopperText )

Test that copper_text.brd imports the "TESTING" text on F.Cu.

Definition at line 472 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), F_Cu, IsCopperLayer(), PCB_TEXT_T, and text.

◆ BOOST_AUTO_TEST_CASE() [17/51]

BOOST_AUTO_TEST_CASE ( DiffPairNetclass )

Verify that diff pair match groups in BeagleBone Black produce netclasses with the DP_ prefix and contain exactly 2 nets each.

Definition at line 2450 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), NETCLASS::GetName(), BOARD::GetNetInfo(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [18/51]

BOOST_AUTO_TEST_CASE ( FootprintLayerPlacement )

Verify that footprints are placed on the correct layer.

Tests that bottom-layer components are imported with correct layer assignment. BeagleBone Black C78 is known to be a bottom-layer component.

Definition at line 901 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), B_Cu, BOOST_TEST_MESSAGE(), F_Cu, BOARD::Footprints(), FOOTPRINT::GetLayer(), BOARD::GetLayerName(), and FOOTPRINT::IsFlipped().

◆ BOOST_AUTO_TEST_CASE() [19/51]

BOOST_AUTO_TEST_CASE ( FootprintOrientation )

Verify that footprint J1 in BeagleBone_Black_RevC imports at 180 degrees orientation.

This catches a bug where EDA_ANGLE was constructed without DEGREES_T, causing the rotation value to be misinterpreted.

Definition at line 2368 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), EDA_ANGLE::AsDegrees(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), and FOOTPRINT::GetOrientation().

◆ BOOST_AUTO_TEST_CASE() [20/51]

BOOST_AUTO_TEST_CASE ( FootprintRefDes )

Test that footprints have valid reference designators.

Definition at line 81 of file test_allegro_import.cpp.

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

◆ BOOST_AUTO_TEST_CASE() [21/51]

BOOST_AUTO_TEST_CASE ( LegacyNetclassFlags )

Verify that the importer sets the legacy netclass and design settings flags so that netclasses survive the SetProject() call during UI import (which replaces m_NetSettings with the project's version unless these flags are set).

Definition at line 3146 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), PCB_IO_ALLEGRO::LoadBoard(), and IO_BASE::SetReporter().

◆ BOOST_AUTO_TEST_CASE() [22/51]

BOOST_AUTO_TEST_CASE ( MatchGroupCounts )

Verify the total number of match group netclasses across all boards that have them.

BeagleBone Black has 17 diff pair groups and 4 match groups (21 total).

Definition at line 2527 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::m_NetSettings, and name.

◆ BOOST_AUTO_TEST_CASE() [23/51]

BOOST_AUTO_TEST_CASE ( MatchGroupNetclass )

Verify that match groups with more than 2 nets (DDR byte lanes, address buses) produce netclasses with the MG_ prefix.

Definition at line 2485 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), NETCLASS::GetName(), BOARD::GetNetInfo(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [24/51]

BOOST_AUTO_TEST_CASE ( NetclassesCreatedForAllBoards )

Verify that netclasses with correct DRC values are created for every board that has constraint sets.

Tests the full matrix of boards and their expected netclass counts.

Definition at line 3171 of file test_allegro_import.cpp.

References BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::m_NetSettings, and name.

◆ BOOST_AUTO_TEST_CASE() [25/51]

BOOST_AUTO_TEST_CASE ( NetclassTraceWidths )

Verify that per-net trace width constraints from Allegro FIELD blocks are imported as KiCad netclass track width settings.

ProiectBoard has 17 nets at 20mil and 2 at 24mil.

Definition at line 2399 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), NETCLASS::GetName(), BOARD::GetNetInfo(), and BOARD_DESIGN_SETTINGS::m_NetSettings.

◆ BOOST_AUTO_TEST_CASE() [26/51]

BOOST_AUTO_TEST_CASE ( NoMatchGroupsOnSimpleBoard )

Verify that boards without match groups (e.g., simple boards) don't produce any DP_ or MG_ netclasses.

Definition at line 2556 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::m_NetSettings, and name.

◆ BOOST_AUTO_TEST_CASE() [27/51]

◆ BOOST_AUTO_TEST_CASE() [28/51]

BOOST_AUTO_TEST_CASE ( OutlineEndpoints )

For boards with line-only outlines, verify each segment endpoint matches the .alg reference within tolerance.

Allegro's Y axis is inverted relative to KiCad, so we compare absolute coordinate differences.

Definition at line 1771 of file test_allegro_import.cpp.

References std::abs(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), ALG_OUTLINE_DATA::designOutlineCount, ALG_OUTLINE_DATA::designOutlineSegments, BOARD::Drawings(), Edge_Cuts, end, getBoardsWithAlg(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), ALG_OUTLINE_DATA::LINE, ALG_OUTLINE_DATA::ParseAlgOutlines(), PCB_SHAPE_T, ALG_OUTLINE_DATA::RECTANGLE, SEGMENT, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [29/51]

BOOST_AUTO_TEST_CASE ( OutlineSegmentCount )

Compare board outline segment count from binary import against .alg reference.

Uses DESIGN_OUTLINE records since those are what the binary importer targets.

Definition at line 1638 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), ALG_OUTLINE_DATA::designOutlineCount, BOARD::Drawings(), Edge_Cuts, ALG_OUTLINE_DATA::expectedEdgeCutsSegments(), getBoardsWithAlg(), ALG_OUTLINE_DATA::outlineCount, ALG_OUTLINE_DATA::ParseAlgOutlines(), and PCB_SHAPE_T.

◆ BOOST_AUTO_TEST_CASE() [30/51]

BOOST_AUTO_TEST_CASE ( PadContainedInFabOutline )

Verify that footprint pads are contained within their F.Fab outline bounding box.

This catches coordinate-space bugs where 0x0D pad positions (footprint-local) are incorrectly treated as board-absolute, causing pads to be placed far from their footprint's fabrication outline.

Definition at line 2187 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), B_Fab, BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOX2< Vec >::Contains(), F_Fab, BOARD::Footprints(), BOX2< Vec >::Inflate(), BOX2< Vec >::Merge(), pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [31/51]

BOOST_AUTO_TEST_CASE ( PadDrillConsistency )

Verify PTH pads have nonzero drill and SMD pads have zero drill across all boards.

Definition at line 1933 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), pad, PTH, and SMD.

◆ BOOST_AUTO_TEST_CASE() [32/51]

BOOST_AUTO_TEST_CASE ( PadNumbers )

Test that pad numbers are set correctly.

Definition at line 231 of file test_allegro_import.cpp.

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

◆ BOOST_AUTO_TEST_CASE() [33/51]

BOOST_AUTO_TEST_CASE ( PadOrientationP6P10 )

Verify pad orientation on footprints P6 and P10.

The binary format stores pad rotation in footprint-local space via 0x0D. An earlier bug double-subtracted footprint rotation, causing pads to appear rotated 90 degrees from their correct orientation.

Definition at line 2267 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOARD::Footprints(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), and pad.

◆ BOOST_AUTO_TEST_CASE() [34/51]

BOOST_AUTO_TEST_CASE ( PadsInsideOutline )

◆ BOOST_AUTO_TEST_CASE() [35/51]

BOOST_AUTO_TEST_CASE ( PadSizes )

Test that pads have valid sizes and are not degenerate.

Definition at line 110 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), F_Cu, pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [36/51]

BOOST_AUTO_TEST_CASE ( PadSizesPositive )

Verify that all pads have positive sizes (no negative dimensions).

Definition at line 640 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), F_Cu, BOARD::Footprints(), pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [37/51]

BOOST_AUTO_TEST_CASE ( PreV16FileRejection )

Verify that pre-v16 Allegro files are rejected with an informative error message rather than an opaque "Unknown Allegro file version" error.

Definition at line 412 of file test_allegro_import.cpp.

References IO_ERROR::What().

◆ BOOST_AUTO_TEST_CASE() [38/51]

BOOST_AUTO_TEST_CASE ( PreV172_NoTeardrops )

Verify that pre-V172 boards (which lack the m_Unknown2 discriminator field) have no teardrop zones and no pads/vias with teardrops enabled.

Definition at line 3109 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::Footprints(), pad, and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [39/51]

BOOST_AUTO_TEST_CASE ( QuadPackagePadRotation )

Verify that pads on quad flat packages (QFN/QFP) have proper rotation.

Pads on the sides should be rotated 90° from each other.

Definition at line 785 of file test_allegro_import.cpp.

References EDA_ANGLE::AsDegrees(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Merge(), EDA_ANGLE::Normalize(), and pad.

◆ BOOST_AUTO_TEST_CASE() [40/51]

BOOST_AUTO_TEST_CASE ( RectsZoneVsCopperPolygon )

Test that rects.brd imports one zone fill (left rectangle) and one standalone copper polygon with a net (right rectangle).

Verifies that BOUNDARY shapes with unnamed nets correctly resolve their net from overlapping fills.

Definition at line 431 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), ZONE::GetFirstLayer(), PCB_SHAPE::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), EDA_SHAPE::GetShape(), IsCopperLayer(), ZONE::IsFilled(), PCB_SHAPE_T, and POLY.

◆ BOOST_AUTO_TEST_CASE() [41/51]

BOOST_AUTO_TEST_CASE ( SlotHoles )

Verify that oblong (slot) drill holes are imported with the correct shape and dimensions.

The builder must set PAD_DRILL_SHAPE::OBLONG when width != height.

BeagleBone Black has 7 slot holes in total: 2x 50x15 mil, 2x 95x40 mil, 1x 120x40 mil @90, 1x 120x40 mil, 1x 140x40 mil

Definition at line 2323 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), OBLONG, pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [42/51]

BOOST_AUTO_TEST_CASE ( SmdFootprintTechLayers )

Verify that SMD-only footprint tech layers are consistent with the footprint side.

A front-side SMD footprint should have shapes/text only on front tech layers (F.SilkS, F.CrtYd, F.Fab, F.Mask, F.Paste). A bottom-side SMD footprint should have them only on back tech layers. Mixed-side items indicate the importer failed to canonicalize footprint children before flipping.

Definition at line 2860 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), BOARD::GetLayerName(), IsBackLayer(), IsFrontLayer(), pad, PTH, and SMD.

◆ BOOST_AUTO_TEST_CASE() [43/51]

BOOST_AUTO_TEST_CASE ( SmdPadDetection )

Verify that pads with no drill hole are properly marked as SMD.

If a pad has drill size of 0, it should have PAD_ATTRIB::SMD, not PTH.

Definition at line 728 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), NPTH, pad, PTH, and SMD.

◆ BOOST_AUTO_TEST_CASE() [44/51]

BOOST_AUTO_TEST_CASE ( SmdPadLayerConsistency )

Verify that SMD pad layer sets are consistent with their parent footprint side.

In KiCad, footprint definitions always use F.Cu for SMD pads. When a footprint is placed on the bottom of the board, Flip() moves pads to B.Cu. So after import:

  • Front footprints should have SMD pads on F.Cu
  • Bottom footprints should have SMD pads on B.Cu

Definition at line 2800 of file test_allegro_import.cpp.

References B_Cu, BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), LSET::Contains(), F_Cu, BOARD::Footprints(), pad, and SMD.

◆ BOOST_AUTO_TEST_CASE() [45/51]

BOOST_AUTO_TEST_CASE ( TrackWidths )

Test that track widths are reasonable.

Definition at line 200 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and PCB_TRACE_T.

◆ BOOST_AUTO_TEST_CASE() [46/51]

BOOST_AUTO_TEST_CASE ( UIImportPath_NullBoard )

Test that LoadBoard works when aAppendToMe is nullptr, which is the path used by the KiCad UI "Import Non-KiCad Board" flow.

The plugin must create and return a new BOARD.

Definition at line 2754 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_TEST_MESSAGE(), KI_TEST::CAPTURING_REPORTER::GetErrorCount(), PCB_IO_ALLEGRO::LoadBoard(), KI_TEST::CAPTURING_REPORTER::PrintAllMessages(), KI_TEST::PrintBoardStats(), IO_BASE::SetReporter(), IO_ERROR::What(), and IO_ERROR::what().

◆ BOOST_AUTO_TEST_CASE() [47/51]

BOOST_AUTO_TEST_CASE ( ViaDrillNotLargerThanSize )

Verify that via drill sizes are not larger than via diameters.

This would indicate a parsing error in the padstack.

Definition at line 682 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), F_Cu, PCB_VIA_T, BOARD::Tracks(), and via.

◆ BOOST_AUTO_TEST_CASE() [48/51]

BOOST_AUTO_TEST_CASE ( ViaSizes )

Test that vias have valid sizes (not hardcoded fallback values).

Definition at line 157 of file test_allegro_import.cpp.

References BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), F_Cu, PCB_VIA_T, and via.

◆ BOOST_AUTO_TEST_CASE() [49/51]

BOOST_AUTO_TEST_CASE ( ZoneBoundingBoxes )

◆ BOOST_AUTO_TEST_CASE() [50/51]

BOOST_AUTO_TEST_CASE ( ZoneCountMatchesAlg )

◆ BOOST_AUTO_TEST_CASE() [51/51]

BOOST_AUTO_TEST_CASE ( ZoneLayerDistribution )

◆ getBoardsWithAlg()

static std::vector< BRD_ALG_PAIR > getBoardsWithAlg ( )
static

Get a list of all board files in the test data that have a corresponding .alg reference file.

This allows us to automatically run cross-validation tests on all boards with reference data.

Definition at line 1295 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardDataDir().

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(), and BOOST_AUTO_TEST_CASE().