catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Remove <algorithm> header from the common path
- Commit
597fca3c8971500fe541417c7434e85d9a41b8c2- Author
- Martin Hořeňovský ·
- Parents
f99f5111550f
Changes
include/internal/catch_approx.cpp | 7 +++++++ include/internal/catch_approx.hpp | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_approx.cpp b/include/internal/catch_approx.cpp index 98fc7bce..419a9cd6 100644 --- a/include/internal/catch_approx.cpp +++ b/include/internal/catch_approx.cpp @@ -13,6 +13,13 @@ namespace Catch { namespace Detail { + double max(double lhs, double rhs) { + if (lhs < rhs) { + return rhs; + } + return lhs; + } + Approx::Approx ( double value ) : m_epsilon( std::numeric_limits<float>::epsilon()*100 ), m_margin( 0.0 ), diff --git a/include/internal/catch_approx.hpp b/include/internal/catch_approx.hpp index 590c8f5b..2185b8f6 100644 --- a/include/internal/catch_approx.hpp +++ b/include/internal/catch_approx.hpp @@ -10,7 +10,6 @@ #include "catch_tostring.h" -#include <algorithm> #include <cmath> #include <type_traits> @@ -18,6 +17,8 @@ namespace Catch { namespace Detail { + double max(double lhs, double rhs); + class Approx { public: explicit Approx ( double value ); @@ -42,7 +43,7 @@ namespace Detail { friend bool operator == ( const T& lhs, Approx const& rhs ) { // Thanks to Richard Harris for his help refining this formula auto lhs_v = static_cast<double>(lhs); - bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (std::max)(std::fabs(lhs_v), std::fabs(rhs.m_value))); + bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (max)(std::fabs(lhs_v), std::fabs(rhs.m_value))); if (relativeOK) { return true; }