69 std::ifstream file( aFilePath, std::ios::binary );
75 file.read(
reinterpret_cast<char*
>(
header ), 8 );
77 if( file.gcount() < 8 )
80 static const uint8_t
expected[] = { 0x07,
'D',
'T',
'S',
'C',
'H',
'E',
'M' };
99 +
"../eeschema/plugins/diptrace/z80_board.dch";
101 BOOST_CHECK( HasDipTraceSchematicHeader( schPath ) );
112 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
114 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
118 std::set<wxString> refDesSet;
120 for(
const FOOTPRINT* fp : board->Footprints() )
122 wxString ref = fp->GetReference();
125 refDesSet.insert( ref );
129 BOOST_CHECK_GT( refDesSet.size(), 10 );
134 for(
const wxString& ref : refDesSet )
136 if( ref.StartsWith(
"U" ) || ref.StartsWith(
"IC" ) || ref.StartsWith(
"DD" ) )
144 "Z80 board should have at least one IC/U-prefixed reference" );
155 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
157 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
161 std::set<wxString> netNames;
165 if( net->GetNetCode() > 0 )
166 netNames.insert( net->GetNetname() );
170 BOOST_CHECK_GT( netNames.size(), 20 );
173 BOOST_CHECK( netNames.count( wxT(
"GND" ) ) > 0 );
174 BOOST_CHECK( netNames.count( wxT(
"A0" ) ) > 0 );
175 BOOST_CHECK( netNames.count( wxT(
"D0" ) ) > 0 );
185 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
187 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
190 BOOST_CHECK_GT( board->Footprints().size(), 10 );
194 for(
const FOOTPRINT* fp : board->Footprints() )
195 totalPads +=
static_cast<int>( fp->Pads().size() );
197 BOOST_CHECK_GT( totalPads, 0 );
General utilities for PCB file IO for QA programs.
Handle the data for a net.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
Pcbnew PCB_IO for DipTrace binary .dip board files.
DIPTRACE_CROSS_LINK_FIXTURE()
std::string GetPcbTestDataDir()
bool HasDipTraceSchematicHeader(const std::string &aFilePath)
Check the first 8 bytes of a file for the DipTrace schematic magic: 0x07 "DTSCHEM".
PCB_IO_DIPTRACE m_pcbPlugin
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(SchematicHeaderValid)
Verify that the paired Z80 Board schematic file (.dch) has a valid DipTrace schematic header.
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)
std::vector< std::string > header
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")