mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-23 05:46:11 +01:00
Backport changes from 7bea1e2ac36ac54b648ae5c9d381a59bc69db912 to fix #2273 for 2.x
This commit is contained in:
parent
85c9544fa4
commit
3d01f3ae32
@ -33,7 +33,7 @@ namespace Detail {
|
|||||||
Approx operator-() const;
|
Approx operator-() const;
|
||||||
|
|
||||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
Approx operator()( T const& value ) {
|
Approx operator()( T const& value ) const {
|
||||||
Approx approx( static_cast<double>(value) );
|
Approx approx( static_cast<double>(value) );
|
||||||
approx.m_epsilon = m_epsilon;
|
approx.m_epsilon = m_epsilon;
|
||||||
approx.m_margin = m_margin;
|
approx.m_margin = m_margin;
|
||||||
|
@ -212,4 +212,11 @@ TEST_CASE( "Comparison with explicitly convertible types", "[Approx]" )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Approx::operator() is const correct", "[Approx][.approvals]") {
|
||||||
|
const Approx ap = Approx(0.0).margin(0.01);
|
||||||
|
|
||||||
|
// As long as this compiles, the test should be considered passing
|
||||||
|
REQUIRE(1.0 == ap(1.0));
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace ApproxTests
|
}} // namespace ApproxTests
|
||||||
|
Loading…
Reference in New Issue
Block a user