enclosed more min/ max in parentheses to default MFC macros

This commit is contained in:
Phil Nash 2017-10-12 16:00:04 +01:00
parent 276393e4e5
commit 2eb93f47f7
4 changed files with 7 additions and 6 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -25,7 +25,7 @@ namespace Catch {
return std::rand() % n;
}
RandomNumberGenerator::result_type RandomNumberGenerator::operator()() const {
return std::rand() % max();
return std::rand() % (max)();
}
}

View File

@ -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;