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

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft
diff options
context:
space:
mode:
authorLeitwolf112026-10-29 19:30:46 +0300
committerLeitwolf112026-10-29 19:30:46 +0300
commit0b4b57a0688f2943f4c797c20d68d533cf70fd15 (patch)
tree3af5223ff664544d15eaf20a10eccdf3465d9958 /src/Progmasoft
parentf41a9c3c01b4df1100e24a63987716cb4dbf28f2 (diff)
downloadcatch3-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 'src/Progmasoft')
-rw-r--r--src/Progmasoft/Runner/ProjectConfig.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Progmasoft/Runner/ProjectConfig.cpp b/src/Progmasoft/Runner/ProjectConfig.cpp
index ea5d921f..ca1957d4 100644
--- a/src/Progmasoft/Runner/ProjectConfig.cpp
+++ b/src/Progmasoft/Runner/ProjectConfig.cpp
@@ -16,7 +16,7 @@ namespace Progmasoft::Catch3::Runner
namespace
{
/// The version of the file format this runner reads.
- constexpr double kConfigVersion = 1;
+ constexpr std::uint64_t kConfigVersion = 1;
/// What the value of a key is, and how it becomes arguments.
enum class ValueKind : std::uint8_t
@@ -175,7 +175,7 @@ namespace Progmasoft::Catch3::Runner
}
const double number = value.AsNumber();
if (!std::isfinite(number) || number < 0
- || number != std::floor(number) || number > 9007199254740992.0)
+ || number > std::floor(number) || number > 9007199254740992.0)
{
return std::nullopt;
}
@@ -434,7 +434,7 @@ namespace Progmasoft::Catch3::Runner
}
if (name == "version")
{
- if (!value.IsNumber() || value.AsNumber() != kConfigVersion)
+ if (WholeNumber(value) != kConfigVersion)
{
return Error{
prefix + "version " + value.ToString()