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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-12-10 16:26:07 +0100
committerMartin Hořeňovský2023-12-10 19:53:46 +0100
commitcb07ff9a7eaf586bfcd74337373192733090675d (patch)
tree0efba7868815dbd11fd9f62f3dd529b3028eda6c /src/catch2/internal
parentae4fe16b81d819bbef8920eddf8d38a3538fe826 (diff)
downloadcatch3-cb07ff9a7eaf586bfcd74337373192733090675d.tar.gz
Fix uniform_floating_point_distribution for unit ranges
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_random_floating_point_helpers.hpp4
-rw-r--r--src/catch2/internal/catch_uniform_floating_point_distribution.hpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/catch2/internal/catch_random_floating_point_helpers.hpp b/src/catch2/internal/catch_random_floating_point_helpers.hpp
index d75b4218..c59c0539 100644
--- a/src/catch2/internal/catch_random_floating_point_helpers.hpp
+++ b/src/catch2/internal/catch_random_floating_point_helpers.hpp
@@ -31,7 +31,7 @@ namespace Catch {
"gamma returns the largest ULP magnitude within "
"floating point range [a, b]. This only makes sense "
"for floating point types" );
- assert( a < b );
+ assert( a <= b );
const auto gamma_up = Catch::nextafter( a, std::numeric_limits<FloatType>::infinity() ) - a;
const auto gamma_down = b - Catch::nextafter( b, -std::numeric_limits<FloatType>::infinity() );
@@ -69,7 +69,7 @@ namespace Catch {
template <typename FloatType>
DistanceType<FloatType>
count_equidistant_floats( FloatType a, FloatType b, FloatType distance ) {
- assert( a < b );
+ assert( a <= b );
// We get distance as gamma for our uniform float distribution,
// so this will round perfectly.
const auto ag = a / distance;
diff --git a/src/catch2/internal/catch_uniform_floating_point_distribution.hpp b/src/catch2/internal/catch_uniform_floating_point_distribution.hpp
index a1cdfe43..23d03b43 100644
--- a/src/catch2/internal/catch_uniform_floating_point_distribution.hpp
+++ b/src/catch2/internal/catch_uniform_floating_point_distribution.hpp
@@ -97,7 +97,7 @@ public:
m_max_steps_in_one_go( Detail::calculate_max_steps_in_one_go(m_ulp_magnitude)),
m_a_has_leq_magnitude(std::fabs(m_a) <= std::fabs(m_b))
{
- assert( a < b );
+ assert( a <= b );
}
template <typename Generator>