Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-02-03 15:07:59 +0100
committerMartin Hořeňovský2020-02-03 15:14:59 +0100
commitc3a5e21648ba4cde517ed17682b1d61833c27679 (patch)
tree3f5bc83ca207ca5de42c4a96aa5f3e9f1e9712c3
parentbd9520c0f99f06202bd939cd947480259d4afffb (diff)
downloadcatch3-c3a5e21648ba4cde517ed17682b1d61833c27679.tar.gz
Move Approx out of the Detail namespace
-rw-r--r--src/catch2/catch.hpp2
-rw-r--r--src/catch2/catch_approx.cpp13
-rw-r--r--src/catch2/catch_approx.h10
-rw-r--r--src/catch2/catch_matchers_vector.h2
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt2
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp2
-rw-r--r--tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp2
-rw-r--r--tests/SelfTest/UsageTests/Approx.tests.cpp2
-rw-r--r--tests/SelfTest/UsageTests/Condition.tests.cpp2
12 files changed, 18 insertions, 25 deletions
diff --git a/src/catch2/catch.hpp b/src/catch2/catch.hpp
index a26cb080..3ecbdf69 100644
--- a/src/catch2/catch.hpp
+++ b/src/catch2/catch.hpp
@@ -60,6 +60,4 @@
#include <catch2/catch_reenable_warnings.h>
-using Catch::Detail::Approx;
-
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
diff --git a/src/catch2/catch_approx.cpp b/src/catch2/catch_approx.cpp
index c1a9170f..4296e8d5 100644
--- a/src/catch2/catch_approx.cpp
+++ b/src/catch2/catch_approx.cpp
@@ -23,7 +23,6 @@ bool marginComparison(double lhs, double rhs, double margin) {
}
namespace Catch {
-namespace Detail {
Approx::Approx ( double value )
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
@@ -70,18 +69,16 @@ namespace Detail {
m_epsilon = newEpsilon;
}
-} // end namespace Detail
-
namespace literals {
- Detail::Approx operator "" _a(long double val) {
- return Detail::Approx(val);
+ Approx operator "" _a(long double val) {
+ return Approx(val);
}
- Detail::Approx operator "" _a(unsigned long long val) {
- return Detail::Approx(val);
+ Approx operator "" _a(unsigned long long val) {
+ return Approx(val);
}
} // 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();
}
diff --git a/src/catch2/catch_approx.h b/src/catch2/catch_approx.h
index e6a846b7..9dc9f292 100644
--- a/src/catch2/catch_approx.h
+++ b/src/catch2/catch_approx.h
@@ -13,7 +13,6 @@
#include <type_traits>
namespace Catch {
-namespace Detail {
class Approx {
private:
@@ -115,16 +114,15 @@ namespace Detail {
double m_scale;
double m_value;
};
-} // end namespace Detail
namespace literals {
- Detail::Approx operator "" _a(long double val);
- Detail::Approx operator "" _a(unsigned long long val);
+ Approx operator "" _a(long double val);
+ Approx operator "" _a(unsigned long long val);
} // end namespace literals
template<>
-struct StringMaker<Catch::Detail::Approx> {
- static std::string convert(Catch::Detail::Approx const& value);
+struct StringMaker<Catch::Approx> {
+ static std::string convert(Catch::Approx const& value);
};
} // end namespace Catch
diff --git a/src/catch2/catch_matchers_vector.h b/src/catch2/catch_matchers_vector.h
index f41e7fcc..86fb2214 100644
--- a/src/catch2/catch_matchers_vector.h
+++ b/src/catch2/catch_matchers_vector.h
@@ -124,7 +124,7 @@ namespace Matchers {
}
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>
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index 6bad3c92..7716196d 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -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: 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: 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: config.benchmarkNoAnalysis for: true
Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1
diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt
index 6665214a..3dc7166c 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -8022,7 +8022,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
- REQUIRE( config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99) )
+ REQUIRE( config.benchmarkConfidenceInterval == Catch::Approx(0.99) )
with expansion:
0.99 == Approx( 0.99 )
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index 9560c81a..d2bda84f 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -2139,7 +2139,7 @@ ok 1067 - config.benchmarkResamples == 20000 for: 20000 (0x<hex digits>) == 2000
# Process can be configured on command line
ok 1068 - cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) for: {?}
# 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
ok 1070 - cli.parse({ "test", "--benchmark-no-analysis" }) for: {?}
# Process can be configured on command line
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index 5b07c107..521bdd54 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -10103,7 +10103,7 @@ Nor would this
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
- config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99)
+ config.benchmarkConfidenceInterval == Catch::Approx(0.99)
</Original>
<Expanded>
0.99 == Approx( 0.99 )
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index c2a4db0a..bff30f2c 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -489,7 +489,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
SECTION("resamples") {
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") {
diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
index 3406480e..17bc58e6 100644
--- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
@@ -178,7 +178,7 @@ TEST_CASE("Generators internals", "[generators][internals]") {
}
SECTION("Floating Point") {
- using Catch::Detail::Approx;
+ using Catch::Approx;
SECTION("Exact") {
const auto rangeStart = -1.;
const auto rangeEnd = 1.;
diff --git a/tests/SelfTest/UsageTests/Approx.tests.cpp b/tests/SelfTest/UsageTests/Approx.tests.cpp
index 181d2d4c..9a1f0474 100644
--- a/tests/SelfTest/UsageTests/Approx.tests.cpp
+++ b/tests/SelfTest/UsageTests/Approx.tests.cpp
@@ -11,7 +11,7 @@
#include <cmath>
-using Catch::Detail::Approx;
+using Catch::Approx;
namespace { namespace ApproxTests {
diff --git a/tests/SelfTest/UsageTests/Condition.tests.cpp b/tests/SelfTest/UsageTests/Condition.tests.cpp
index 489d6994..28ca8dd6 100644
--- a/tests/SelfTest/UsageTests/Condition.tests.cpp
+++ b/tests/SelfTest/UsageTests/Condition.tests.cpp
@@ -14,7 +14,7 @@
#include <catch2/catch_approx.h>
#include <catch2/catch_test_macros.hpp>
-using Catch::Detail::Approx;
+using Catch::Approx;
#include <string>
#include <limits>