fix comparator
This commit is contained in:
@@ -6,5 +6,5 @@ auto main(int argc, char *argv[]) -> int
|
||||
float c_array[] = { 130.81, 138.59, 146.83, 155.56, 164.81, 174.61, 185.00, 196.00, 207.65, 220.00, 233.08, 246.94 };
|
||||
|
||||
hack::comparators::source(c_array, frequencies.size(), "/mnt/raid/projects/hack/hack/bin/examples/comparators/test.txt");
|
||||
hack::comparators::compare(frequencies, "/mnt/raid/projects/hack/hack/bin/examples/comparators/test.txt");
|
||||
hack::comparators::compare(frequencies, "/mnt/raid/projects/hack/hack/bin/examples/comparators/test.txt");
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user