I’m using the Catch test framework.
In the introductory blog post the author mentions the following feature:
- Floating point tolerances supported in an easy to use way
I couldn’t find any documentation on how to do this. How is this done in Catch?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s simple. There is a class called
Approxthat lets you do this test in a very readable manner:The tolerance can be changed by using the member functions
epsilon()andscale()of theApproxobject, like so:Approx(a).epsilon(e).