diff options
| author | Ian Bell | 2024-04-15 05:35:39 -0600 |
|---|---|---|
| committer | GitHub | 2024-04-15 13:35:39 +0200 |
| commit | 53ddf37af4488cac7724761858ae3cca9d2d65e7 (patch) | |
| tree | 76b3ea40c8f489b2300dc19096fe8cd617b14349 /src/catch2 | |
| parent | 029fe3b4609dd84cd939b73357f37bbb75bcf82f (diff) | |
| download | catch3-53ddf37af4488cac7724761858ae3cca9d2d65e7.tar.gz | |
Use Catch::StringMaker for output in WithinRelMatcher (#2846)
The WithinRelMatcher does not listen to the precision specification; it just naively pipes to stringstream. If you specify the precision, that has no impact on the outputted values when the match fails.
This fix makes the WithinRelMatcher listen to the precision (https://github.com/catchorg/Catch2/blob/devel/docs/tostring.md#floating-point-precision) specified by: Catch::StringMaker<float>::precision
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/matchers/catch_matchers_floating_point.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/catch2/matchers/catch_matchers_floating_point.cpp b/src/catch2/matchers/catch_matchers_floating_point.cpp index 206332ef..fc7b444e 100644 --- a/src/catch2/matchers/catch_matchers_floating_point.cpp +++ b/src/catch2/matchers/catch_matchers_floating_point.cpp @@ -176,7 +176,7 @@ namespace Detail { std::string WithinRelMatcher::describe() const { Catch::ReusableStringStream sstr; - sstr << "and " << m_target << " are within " << m_epsilon * 100. << "% of each other"; + sstr << "and " << ::Catch::Detail::stringify(m_target) << " are within " << m_epsilon * 100. << "% of each other"; return sstr.str(); } |