52 std::vector<wxString> cases = {
53 "Reverb_BTDR-1V.kicad_mod",
54 "Samtec_HLE-133-02-xx-DV-PE-LC_2x33_P2.54mm_Horizontal.kicad_mod",
55 "group_and_image.kicad_pcb"
58 std::unique_ptr<BOARD_ITEM_CONTAINER> original, prettified, golden;
61 std::string tempLibPath = fmt::format(
"{}/prettifier.pretty",
62 std::filesystem::temp_directory_path() );
63 std::filesystem::remove_all( tempLibPath );
64 std::filesystem::create_directory( tempLibPath );
66 for(
const wxString& testCase : cases )
68 std::string testCaseName = testCase.ToStdString();
79 std::stringstream inBuf;
80 inBuf << inFp.rdbuf();
81 std::string inData = inBuf.str();
95 std::string tempPath = fmt::format(
"{}/{}", tempLibPath, testCaseName );
97 tempFp.open( tempPath );
106 BOOST_CHECK_NO_THROW(
113 const_cast<KIID&
>( prettified->m_Uuid ) = original->m_Uuid;
116 BOOST_REQUIRE_MESSAGE( *original == *prettified,
117 "Formatted version of original board item does not parse the same way!" );
120 std::string base = testCase.BeforeLast(
'.' ).ToStdString();
121 std::string ext = testCase.AfterLast(
'.' ).ToStdString();
123 std::string goldenPath = fmt::format(
"{}prettifier/{}_formatted.{}",
126 std::ifstream goldFp;
127 goldFp.open( goldenPath );
130 std::stringstream goldenBuf;
131 goldenBuf << goldFp.rdbuf();
133 BOOST_REQUIRE_MESSAGE( goldenBuf.str().compare( inData ) == 0,
134 "Formatting result doesn't match golden!" );
136 std::filesystem::remove( tempPath );
140 std::filesystem::remove_all( tempLibPath );