fix comparator

This commit is contained in:
2025-10-30 15:33:18 +03:00
parent 7586d07243
commit a448728a3d
2 changed files with 22 additions and 22 deletions

View File

@@ -94,30 +94,30 @@ namespace hack::comparators
return res;
}
}
template<typename T>
inline void compare(const std::vector<T>& in, const std::filesystem::path& path, float epsilon = 1e-6f)
template<typename T>
inline void compare(const std::vector<T>& in, const std::filesystem::path& path, float epsilon = 1e-6f)
{
auto r = compare_float_array_with_file(in, path, epsilon);
log().set_devider("");
log()("result: ", r.m_is_equal == true ? "TRUE " : "FALSE ");
if (!r.m_is_equal)
{
auto r = compare_float_array_with_file(in, path, epsilon);
log().set_devider("");
log()("result: ", r.m_is_equal == true ? "TRUE " : "FALSE ");
if (!r.m_is_equal)
{
log()("total errors: ", r.m_mismatch_count);
log()("source size: ", r.m_file_size, " target size: ", r.m_input_size);
log()("mismatch indices: ", r.m_mismatch_indices);
}
log().reset();
log()("total errors: ", r.m_mismatch_count);
log()("source size: ", r.m_file_size, " target size: ", r.m_input_size);
log()("mismatch indices: ", r.m_mismatch_indices);
}
log().reset();
try
{
if (std::filesystem::exists(path))
std::filesystem::remove(path);
}
catch (const std::filesystem::filesystem_error& e)
{
error()("Failed to delete file: ", e.what());
}
try
{
if (std::filesystem::exists(path))
std::filesystem::remove(path);
}
catch (const std::filesystem::filesystem_error& e)
{
error()("Failed to delete file: ", e.what());
}
}
}