Progmasoft Git

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

enclosed more min/ max in parentheses to default MFC macros

Commit
2eb93f47f7523146b3a10a22034c3525fde92bbe
Author
Phil Nash ·
Parents
276393e4e59b

Files · Download .tar.gz

Changes

 include/internal/catch_approx.cpp                  | 2 +-
 include/internal/catch_approx.h                    | 5 +++--
 include/internal/catch_random_number_generator.cpp | 2 +-
 include/internal/catch_random_number_generator.h   | 4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/internal/catch_approx.cpp b/include/internal/catch_approx.cpp
index 51f4b243..ca3ac94a 100644
--- a/include/internal/catch_approx.cpp
+++ b/include/internal/catch_approx.cpp
@@ -13,7 +13,7 @@
 namespace Catch {
 namespace Detail {
 
-    double max(double lhs, double rhs) {
+    double dmax(double lhs, double rhs) {
         if (lhs < rhs) {
             return rhs;
         }
diff --git a/include/internal/catch_approx.h b/include/internal/catch_approx.h
index 2185b8f6..a2af9c86 100644
--- a/include/internal/catch_approx.h
+++ b/include/internal/catch_approx.h
@@ -17,7 +17,7 @@
 namespace Catch {
 namespace Detail {
 
-    double max(double lhs, double rhs);
+    double dmax(double lhs, double rhs);
 
     class Approx {
     public:
@@ -43,7 +43,8 @@ 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 + (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 +
+                    dmax(std::fabs(lhs_v), std::fabs(rhs.m_value)));
             if (relativeOK) {
                 return true;
             }
diff --git a/include/internal/catch_random_number_generator.cpp b/include/internal/catch_random_number_generator.cpp
index 7149a58b..412faeba 100644
--- a/include/internal/catch_random_number_generator.cpp
+++ b/include/internal/catch_random_number_generator.cpp
@@ -25,7 +25,7 @@ namespace Catch {
         return std::rand() % n;
     }
     RandomNumberGenerator::result_type RandomNumberGenerator::operator()() const {
-        return std::rand() % max();
+        return std::rand() % (max)();
     }
 
 }
diff --git a/include/internal/catch_random_number_generator.h b/include/internal/catch_random_number_generator.h
index 859e6cdf..1a61202d 100644
--- a/include/internal/catch_random_number_generator.h
+++ b/include/internal/catch_random_number_generator.h
@@ -22,8 +22,8 @@ namespace Catch {
     struct RandomNumberGenerator {
         using result_type = std::ptrdiff_t;
 
-        static constexpr result_type min() { return 0; }
-        static constexpr result_type max() { return 1000000; }
+        static constexpr result_type (min)() { return 0; }
+        static constexpr result_type (max)() { return 1000000; }
 
         result_type operator()( result_type n ) const;
         result_type operator()() const;