53 std::vector<wxString> cases = {
54 "Reverb_BTDR-1V.kicad_mod",
55 "Samtec_HLE-133-02-xx-DV-PE-LC_2x33_P2.54mm_Horizontal.kicad_mod",
56 "group_and_image.kicad_pcb"
59 std::unique_ptr<BOARD_ITEM_CONTAINER> original, prettified, golden;
62 std::string tempLibPath = fmt::format(
"{}/prettifier.pretty",
63 std::filesystem::temp_directory_path() );
64 std::filesystem::remove_all( tempLibPath );
65 std::filesystem::create_directory( tempLibPath );
67 for(
const wxString& testCase : cases )
69 std::string testCaseName = testCase.ToStdString();
80 std::stringstream inBuf;
81 inBuf << inFp.rdbuf();
82 std::string inData = inBuf.str();
96 std::string tempPath = fmt::format(
"{}/{}", tempLibPath, testCaseName );
98 tempFp.open( tempPath );
107 BOOST_CHECK_NO_THROW(
114 const_cast<KIID&
>( prettified->m_Uuid ) = original->m_Uuid;
117 BOOST_REQUIRE_MESSAGE( *original == *prettified,
118 "Formatted version of original board item does not parse the same way!" );
121 std::string base = testCase.BeforeLast(
'.' ).ToStdString();
122 std::string ext = testCase.AfterLast(
'.' ).ToStdString();
124 std::string goldenPath = fmt::format(
"{}prettifier/{}_formatted.{}",
127 std::ifstream goldFp;
128 goldFp.open( goldenPath );
131 std::stringstream goldenBuf;
132 goldenBuf << goldFp.rdbuf();
134 BOOST_REQUIRE_MESSAGE( goldenBuf.str().compare( inData ) == 0,
135 "Formatting result doesn't match golden!" );
137 std::filesystem::remove( tempPath );
141 std::filesystem::remove_all( tempLibPath );