20#include <boost/test/unit_test.hpp>
43static const char*
DAISY_PCB_FILE =
"net_chains/net_chain_trunk_delay.kicad_pcb";
48std::unique_ptr<BOARD> loadBoard(
const char* aBoardFile )
52 board->BuildConnectivity();
58void tagChainNets(
BOARD* aBoard,
const wxString& aChain )
62 if( n && n->GetNetname().StartsWith( wxS(
"/NET_" ) ) )
63 n->SetNetChain( aChain );
70void setTerminals(
BOARD* aBoard,
const wxString& aChain )
77 if( fp->Pads().empty() )
93 if( n && n->GetNetChain() == aChain )
95 n->SetTerminalPad( 0, first->
Pads().front() );
96 n->SetTerminalPad( 1, last->
Pads().front() );
102std::set<BOARD_CONNECTED_ITEM*> collectChainItems(
BOARD* aBoard,
const wxString& aChain )
104 std::set<BOARD_CONNECTED_ITEM*> items;
108 if( t->GetNet() && t->GetNet()->GetNetChain() == aChain )
114 for(
PAD* p : fp->Pads() )
116 if( p->GetNet() && p->GetNet()->GetNetChain() == aChain )
136 tagChainNets( board.get(), wxS(
"DSY" ) );
137 setTerminals( board.get(), wxS(
"DSY" ) );
139 CHAIN_TOPOLOGY topo( board.get(), wxS(
"DSY" ), collectChainItems( board.get(), wxS(
"DSY" ) ),
143 BOOST_CHECK_CLOSE( topo.
TrunkLength(), 50.0e6, 5.0 );
146 BOOST_CHECK_CLOSE( topo.
TrunkDelay(), expectedDelayIU, 5.0 );
150 auto [bridgingLen, bridgingDelay] =
152 BOOST_CHECK_CLOSE( bridgingDelay, topo.
TrunkDelay(), 0.001 );
153 BOOST_CHECK_CLOSE( bridgingLen, 5.0e6, 0.001 );
164 tagChainNets( board.get(), wxS(
"DSY" ) );
167 CHAIN_TOPOLOGY topo( board.get(), wxS(
"DSY" ), collectChainItems( board.get(), wxS(
"DSY" ) ),
170 BOOST_CHECK( !topo.
IsValid() );
174 auto [bridgingLen, bridgingDelay] =
177 BOOST_CHECK_CLOSE( bridgingLen, 5.0e6, 0.001 );
180 BOOST_CHECK_CLOSE( bridgingDelay, expectedDelayIU, 0.001 );
constexpr EDA_IU_SCALE pcbIUScale
General utilities for PCB file IO for QA programs.
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
Build a topological view of a single named net chain's routed copper.
double TrunkLength() const
double TrunkDelay() const
Handle the data for a net.
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
std::unique_ptr< BOARD > LoadBoard(const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr)
Load information from some input file format that this PCB_IO implementation knows about into new BOA...
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
std::tuple< double, double > BoardChainBridging(const BOARD *aBoard, const wxString &aNetChain, const double aDefaultBridgeUnitDelay)
Compute both the chain bridging length and its associated propagation delay (in internal delay IU,...
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
static const char * DAISY_PCB_FILE
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
constexpr double DEFAULT_PROPAGATION_DELAY_PS_PER_MM
BOOST_AUTO_TEST_CASE(DaisyTrunkDelayEqualsBridgeWithoutStackup)
BOOST_CHECK_EQUAL(result, "25.4")