81 const std::filesystem::path boardPath =
88 const std::filesystem::path outputPath =
89 std::filesystem::temp_directory_path() /
"kicad_d356_midpoint_test.d356";
94 std::ifstream in( outputPath );
99 int expectedViaMask = -1;
101 for(
PCB_TRACK* track : board->Tracks() )
107 const int mask = (
via->IsTented(
F_Mask ) ? 1 : 0 ) | (
via->IsTented(
B_Mask ) ? 2 : 0 );
109 if( expectedViaMask < 0 )
110 expectedViaMask = mask;
112 BOOST_REQUIRE_EQUAL( mask, expectedViaMask );
120 while( std::getline( in, line ) )
123 if( line.size() < 32 || line[0] !=
'3' )
126 const std::string refdes = trim( line.substr( 20, 6 ) );
127 const std::string
pin = trim( line.substr( 27, 4 ) );
128 const char midpoint = line[31];
130 if( refdes ==
"VIA" )
137 const size_t sPos = line.rfind(
'S' );
141 else if(
pin.empty() )
154 BOOST_CHECK_GT( namedPads, 0 );
155 BOOST_CHECK_GT( unnamedPads, 0 );
156 BOOST_CHECK_GT( vias, 0 );
159 std::filesystem::remove( outputPath );
167 const std::vector<std::string> lines = exportD356(
"issue10697.kicad_pcb" );
169 BOOST_CHECK( std::any_of( lines.begin(), lines.end(),
170 [](
const std::string& aLine )
172 return aLine.rfind(
"P VER IPC-D-356A ", 0 ) == 0;
177 for(
size_t ii = 0; ii < lines.size(); ++ii )
179 if( lines[ii].rfind(
"307", 0 ) != 0 )
183 BOOST_REQUIRE_EQUAL( lines[ii].size(), 80u );
189 BOOST_REQUIRE_LT( ii + 1, lines.size() );
190 BOOST_REQUIRE_EQUAL( lines[ii + 1].size(), 80u );
191 BOOST_CHECK_EQUAL( lines[ii + 1].substr( 0, 17 ),
"027" + lines[ii].substr( 3, 14 ) );
199 const std::vector<std::string> longNames = exportD356(
"issue3812.kicad_pcb" );
200 std::vector<std::string> nets;
203 for(
const std::string& line : longNames )
206 nets.push_back( line.substr( 3, 14 ) );
208 if( line.rfind(
"P NNAME", 0 ) == 0 && trim( line.substr( 14 ) ) ==
"/inout_user/CAN_H" )
209 alias = line.substr( 8, 5 );
212 BOOST_CHECK( std::is_sorted( nets.begin(), nets.end() ) );
214 BOOST_REQUIRE_EQUAL( alias.size(), 5u );
215 BOOST_CHECK( std::any_of( longNames.begin(), longNames.end(),
216 [&](
const std::string& aLine )
218 return aLine[0] ==
'3' && trim( aLine.substr( 3, 14 ) ) == alias;
BOOST_CHECK_EQUAL(result, "25.4")