20#include <boost/test/unit_test.hpp>
35static const char*
DAISY_PCB_FILE =
"net_chains/chain_length_daisy.kicad_pcb";
45std::unique_ptr<BOARD> loadBoard(
const char* aBoardFile )
48 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
50 board->BuildConnectivity();
56void tagAndSetTerminals(
BOARD* aBoard,
const wxString& aChain )
60 if( n && n->GetNetname().StartsWith( wxS(
"/NET_" ) ) )
61 n->SetNetChain( aChain );
69 if( fp->Pads().empty() )
85 if( n && n->GetNetChain() == aChain )
87 n->SetTerminalPad( 0, first->
Pads().front() );
88 n->SetTerminalPad( 1, last->
Pads().front() );
102 tagAndSetTerminals( board.get(), wxS(
"DSY" ) );
104 std::set<BOARD_CONNECTED_ITEM*> items;
108 if( t->GetNet() && t->GetNet()->GetNetChain() == wxS(
"DSY" ) )
112 for(
FOOTPRINT* fp : board->Footprints() )
114 for(
PAD* p : fp->Pads() )
116 if( p->GetNet() && p->GetNet()->GetNetChain() == wxS(
"DSY" ) )
124 BOOST_CHECK_CLOSE( topo.
TrunkLength(), 50.0e6, 5.0 );
131 tagAndSetTerminals( board.get(), wxS(
"BR" ) );
133 std::set<BOARD_CONNECTED_ITEM*> items;
137 if( t->GetNet() && t->GetNet()->GetNetChain() == wxS(
"BR" ) )
141 for(
FOOTPRINT* fp : board->Footprints() )
143 for(
PAD* p : fp->Pads() )
145 if( p->GetNet() && p->GetNet()->GetNetChain() == wxS(
"BR" ) )
153 BOOST_CHECK_CLOSE( topo.
TrunkLength(), 50.0e6, 5.0 );
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
Build a topological view of a single named net chain's routed copper.
const std::vector< STUB > & Stubs() const
double TrunkLength() const
Handle the data for a net.
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(DaisyChainTrunkEqualsSumExplicit)
static const char * BRANCHED_PCB_FILE
static const char * DAISY_PCB_FILE
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")