diff --git a/bin/examples/comparators/main.cpp b/bin/examples/comparators/main.cpp index d9ca35d..d184257 100644 --- a/bin/examples/comparators/main.cpp +++ b/bin/examples/comparators/main.cpp @@ -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"); } diff --git a/src/hack/comparators/comparators.hpp b/src/hack/comparators/comparators.hpp index 3b11a02..0d4e7e5 100644 --- a/src/hack/comparators/comparators.hpp +++ b/src/hack/comparators/comparators.hpp @@ -94,30 +94,30 @@ namespace hack::comparators return res; } + } - template - inline void compare(const std::vector& in, const std::filesystem::path& path, float epsilon = 1e-6f) + template + inline void compare(const std::vector& 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()); } } }