65 std::ifstream file( aFilePath, std::ios::binary );
71 file.read(
reinterpret_cast<char*
>(
header ), 8 );
73 if( file.gcount() < 8 )
76 static const uint8_t
expected[] = { 0x07,
'D',
'T',
'S',
'C',
'H',
'E',
'M' };
95 +
"../eeschema/plugins/diptrace/z80_board.dch";
97 BOOST_CHECK( HasDipTraceSchematicHeader( schPath ) );
108 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
110 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
114 std::set<wxString> refDesSet;
116 for(
const FOOTPRINT* fp : board->Footprints() )
118 wxString ref = fp->GetReference();
121 refDesSet.insert( ref );
125 BOOST_CHECK_GT( refDesSet.size(), 10 );
130 for(
const wxString& ref : refDesSet )
132 if( ref.StartsWith(
"U" ) || ref.StartsWith(
"IC" ) || ref.StartsWith(
"DD" ) )
140 "Z80 board should have at least one IC/U-prefixed reference" );
151 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
153 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
157 std::set<wxString> netNames;
161 if( net->GetNetCode() > 0 )
162 netNames.insert( net->GetNetname() );
166 BOOST_CHECK_GT( netNames.size(), 20 );
169 BOOST_CHECK( netNames.count( wxT(
"GND" ) ) > 0 );
170 BOOST_CHECK( netNames.count( wxT(
"A0" ) ) > 0 );
171 BOOST_CHECK( netNames.count( wxT(
"D0" ) ) > 0 );
181 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
183 m_pcbPlugin.LoadBoard( GetPcbTestDataDir() +
"z80_board.dip", board.get() );
186 BOOST_CHECK_GT( board->Footprints().size(), 10 );
190 for(
const FOOTPRINT* fp : board->Footprints() )
191 totalPads +=
static_cast<int>( fp->Pads().size() );
193 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")