mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
parent
91fa55303b
commit
31906d83ec
@ -142,7 +142,7 @@ namespace Floating {
|
|||||||
WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType)
|
WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType)
|
||||||
:m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
|
:m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
|
||||||
CATCH_ENFORCE(m_type == FloatingPointKind::Double
|
CATCH_ENFORCE(m_type == FloatingPointKind::Double
|
||||||
|| m_ulps < std::numeric_limits<uint32_t>::max(),
|
|| m_ulps < (std::numeric_limits<uint32_t>::max)(),
|
||||||
"Provided ULP is impossibly large for a float comparison.");
|
"Provided ULP is impossibly large for a float comparison.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ namespace Floating {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WithinRelMatcher::match(double const& matchee) const {
|
bool WithinRelMatcher::match(double const& matchee) const {
|
||||||
const auto relMargin = m_epsilon * std::max(std::fabs(matchee), std::fabs(m_target));
|
const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target));
|
||||||
return marginComparison(matchee, m_target,
|
return marginComparison(matchee, m_target,
|
||||||
std::isinf(relMargin)? 0 : relMargin);
|
std::isinf(relMargin)? 0 : relMargin);
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ namespace Catch {
|
|||||||
using state_type = std::uint64_t;
|
using state_type = std::uint64_t;
|
||||||
public:
|
public:
|
||||||
using result_type = std::uint32_t;
|
using result_type = std::uint32_t;
|
||||||
static constexpr result_type min() {
|
static constexpr result_type (min)() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static constexpr result_type max() {
|
static constexpr result_type (max)() {
|
||||||
return static_cast<result_type>(-1);
|
return static_cast<result_type>(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user