You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
As in this SO Q&A, it would be nice to allow customization of the precision of floating-point values that fail. At present, the precision for float and double are hard-coded within Catch2 to 5 and 10, respectively:
The proposal here is to add a setPrecision() function to allow the user to control this. I have prototyped this, which you can see running live on Wandbox. Here's the test:
Making a unit test for this is a little iffy since the actual string values are dependent on the usual floating-point fuzziness. I guess it could compare string length without looking too closely at the value.
The text was updated successfully, but these errors were encountered:
Description
As in this SO Q&A, it would be nice to allow customization of the precision of floating-point values that fail. At present, the precision for float and double are hard-coded within Catch2 to 5 and 10, respectively:
Sometimes things will fail (even with
Approx()
), but the precision of the failure message doesn't show enough precision to be meaningful.The proposal here is to add a
setPrecision()
function to allow the user to control this. I have prototyped this, which you can see running live on Wandbox. Here's the test:The output shows as expected for floats and doubles. For instance:
Making a unit test for this is a little iffy since the actual string values are dependent on the usual floating-point fuzziness. I guess it could compare string length without looking too closely at the value.
The text was updated successfully, but these errors were encountered: