diff options
| author | Leitwolf11 | 2026-10-29 19:30:46 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-10-29 19:30:46 +0300 |
| commit | 0b4b57a0688f2943f4c797c20d68d533cf70fd15 (patch) | |
| tree | 3af5223ff664544d15eaf20a10eccdf3465d9958 /tests | |
| parent | f41a9c3c01b4df1100e24a63987716cb4dbf28f2 (diff) | |
| download | catch3-feature/catch3-json.tar.gz | |
Compare whole numbers in catch3.json without floating-point equalityfeature/catch3-json
Clang's -Wfloat-equal, an error in the development builds, rejected the
version check, which compared the JSON number with 1.0 by ==. The version
is now read through the same whole-number check as the counts and
compared as an integer, and that check asks whether the number exceeds
its floor instead of comparing the two for equality. The test of the
confidence interval compares within 1e-12. The amalgamated source is
regenerated.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Progmasoft/RunnerConfig.tests.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/Progmasoft/RunnerConfig.tests.cpp b/tests/Progmasoft/RunnerConfig.tests.cpp index 4dce1f79..3dba3e0b 100644 --- a/tests/Progmasoft/RunnerConfig.tests.cpp +++ b/tests/Progmasoft/RunnerConfig.tests.cpp @@ -4,6 +4,7 @@ // catch3.json: where it is found, what its keys set, how the command line // wins over it and how a wrong file is explained. +#include <Progmasoft/Catch3/Matchers/FloatingPoint.hpp> #include <Progmasoft/Catch3/Matchers/String.hpp> #include <Progmasoft/Catch3/TestMacros.hpp> #include <Progmasoft/Runner/Files.hpp> @@ -21,6 +22,7 @@ namespace namespace Runner = Progmasoft::Catch3::Runner; namespace fs = std::filesystem; using Catch::Matchers::ContainsSubstring; + using Catch::Matchers::WithinAbs; using std::chrono::milliseconds; /// A directory of its own under the system's temporary directory, @@ -221,7 +223,7 @@ TEST_CASE("Keys set the option of the same name", CHECK(options.skipBenchmarks); CHECK(options.benchmarkSamples == 10); CHECK(options.benchmarkResamples == 1000); - CHECK(options.benchmarkConfidenceInterval == 0.9); + CHECK_THAT(options.benchmarkConfidenceInterval, WithinAbs(0.9, 1e-12)); CHECK(options.benchmarkNoAnalysis); CHECK(options.benchmarkWarmupTime == milliseconds{ 5 }); CHECK(options.quarantine == Runner::QuarantineMode::kReport); |