mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Move Approx out of the Detail namespace
This commit is contained in:
parent
bd9520c0f9
commit
c3a5e21648
@ -60,6 +60,4 @@
|
|||||||
|
|
||||||
#include <catch2/catch_reenable_warnings.h>
|
#include <catch2/catch_reenable_warnings.h>
|
||||||
|
|
||||||
using Catch::Detail::Approx;
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
|
||||||
|
@ -23,7 +23,6 @@ bool marginComparison(double lhs, double rhs, double margin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace Detail {
|
|
||||||
|
|
||||||
Approx::Approx ( double value )
|
Approx::Approx ( double value )
|
||||||
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
|
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
|
||||||
@ -70,18 +69,16 @@ namespace Detail {
|
|||||||
m_epsilon = newEpsilon;
|
m_epsilon = newEpsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Detail
|
|
||||||
|
|
||||||
namespace literals {
|
namespace literals {
|
||||||
Detail::Approx operator "" _a(long double val) {
|
Approx operator "" _a(long double val) {
|
||||||
return Detail::Approx(val);
|
return Approx(val);
|
||||||
}
|
}
|
||||||
Detail::Approx operator "" _a(unsigned long long val) {
|
Approx operator "" _a(unsigned long long val) {
|
||||||
return Detail::Approx(val);
|
return Approx(val);
|
||||||
}
|
}
|
||||||
} // end namespace literals
|
} // end namespace literals
|
||||||
|
|
||||||
std::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) {
|
std::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace Detail {
|
|
||||||
|
|
||||||
class Approx {
|
class Approx {
|
||||||
private:
|
private:
|
||||||
@ -115,16 +114,15 @@ namespace Detail {
|
|||||||
double m_scale;
|
double m_scale;
|
||||||
double m_value;
|
double m_value;
|
||||||
};
|
};
|
||||||
} // end namespace Detail
|
|
||||||
|
|
||||||
namespace literals {
|
namespace literals {
|
||||||
Detail::Approx operator "" _a(long double val);
|
Approx operator "" _a(long double val);
|
||||||
Detail::Approx operator "" _a(unsigned long long val);
|
Approx operator "" _a(unsigned long long val);
|
||||||
} // end namespace literals
|
} // end namespace literals
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct StringMaker<Catch::Detail::Approx> {
|
struct StringMaker<Catch::Approx> {
|
||||||
static std::string convert(Catch::Detail::Approx const& value);
|
static std::string convert(Catch::Approx const& value);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
@ -124,7 +124,7 @@ namespace Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<T> const& m_comparator;
|
std::vector<T> const& m_comparator;
|
||||||
mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom();
|
mutable Catch::Approx approx = Catch::Approx::custom();
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -1108,7 +1108,7 @@ CmdLine.tests.cpp:<line number>: passed: config.benchmarkSamples == 200 for: 200
|
|||||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-resamples=20000" }) for: {?}
|
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-resamples=20000" }) for: {?}
|
||||||
CmdLine.tests.cpp:<line number>: passed: config.benchmarkResamples == 20000 for: 20000 (0x<hex digits>) == 20000 (0x<hex digits>)
|
CmdLine.tests.cpp:<line number>: passed: config.benchmarkResamples == 20000 for: 20000 (0x<hex digits>) == 20000 (0x<hex digits>)
|
||||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) for: {?}
|
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) for: {?}
|
||||||
CmdLine.tests.cpp:<line number>: passed: config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99) for: 0.99 == Approx( 0.99 )
|
CmdLine.tests.cpp:<line number>: passed: config.benchmarkConfidenceInterval == Catch::Approx(0.99) for: 0.99 == Approx( 0.99 )
|
||||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-no-analysis" }) for: {?}
|
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-no-analysis" }) for: {?}
|
||||||
CmdLine.tests.cpp:<line number>: passed: config.benchmarkNoAnalysis for: true
|
CmdLine.tests.cpp:<line number>: passed: config.benchmarkNoAnalysis for: true
|
||||||
Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1
|
Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1
|
||||||
|
@ -8022,7 +8022,7 @@ with expansion:
|
|||||||
{?}
|
{?}
|
||||||
|
|
||||||
CmdLine.tests.cpp:<line number>: PASSED:
|
CmdLine.tests.cpp:<line number>: PASSED:
|
||||||
REQUIRE( config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99) )
|
REQUIRE( config.benchmarkConfidenceInterval == Catch::Approx(0.99) )
|
||||||
with expansion:
|
with expansion:
|
||||||
0.99 == Approx( 0.99 )
|
0.99 == Approx( 0.99 )
|
||||||
|
|
||||||
|
@ -2139,7 +2139,7 @@ ok 1067 - config.benchmarkResamples == 20000 for: 20000 (0x<hex digits>) == 2000
|
|||||||
# Process can be configured on command line
|
# Process can be configured on command line
|
||||||
ok 1068 - cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) for: {?}
|
ok 1068 - cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) for: {?}
|
||||||
# Process can be configured on command line
|
# Process can be configured on command line
|
||||||
ok 1069 - config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99) for: 0.99 == Approx( 0.99 )
|
ok 1069 - config.benchmarkConfidenceInterval == Catch::Approx(0.99) for: 0.99 == Approx( 0.99 )
|
||||||
# Process can be configured on command line
|
# Process can be configured on command line
|
||||||
ok 1070 - cli.parse({ "test", "--benchmark-no-analysis" }) for: {?}
|
ok 1070 - cli.parse({ "test", "--benchmark-no-analysis" }) for: {?}
|
||||||
# Process can be configured on command line
|
# Process can be configured on command line
|
||||||
|
@ -10103,7 +10103,7 @@ Nor would this
|
|||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99)
|
config.benchmarkConfidenceInterval == Catch::Approx(0.99)
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
0.99 == Approx( 0.99 )
|
0.99 == Approx( 0.99 )
|
||||||
|
@ -489,7 +489,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
|||||||
SECTION("resamples") {
|
SECTION("resamples") {
|
||||||
CHECK(cli.parse({ "test", "--benchmark-confidence-interval=0.99" }));
|
CHECK(cli.parse({ "test", "--benchmark-confidence-interval=0.99" }));
|
||||||
|
|
||||||
REQUIRE(config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99));
|
REQUIRE(config.benchmarkConfidenceInterval == Catch::Approx(0.99));
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("resamples") {
|
SECTION("resamples") {
|
||||||
|
@ -178,7 +178,7 @@ TEST_CASE("Generators internals", "[generators][internals]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Floating Point") {
|
SECTION("Floating Point") {
|
||||||
using Catch::Detail::Approx;
|
using Catch::Approx;
|
||||||
SECTION("Exact") {
|
SECTION("Exact") {
|
||||||
const auto rangeStart = -1.;
|
const auto rangeStart = -1.;
|
||||||
const auto rangeEnd = 1.;
|
const auto rangeEnd = 1.;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
using Catch::Detail::Approx;
|
using Catch::Approx;
|
||||||
|
|
||||||
namespace { namespace ApproxTests {
|
namespace { namespace ApproxTests {
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <catch2/catch_approx.h>
|
#include <catch2/catch_approx.h>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
using Catch::Detail::Approx;
|
using Catch::Approx;
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
Loading…
Reference in New Issue
Block a user