5 ms·
Floating point comparisons are achieved through the Approx helper class. E.g: REQUIRE( pi == Approx( 3.14159265358 ) ); (and yes, I know pi to a lot more
by phil_nash 16y ago
Floating point comparisons are achieved through the Approx helper class. E.g:
REQUIRE( pi == Approx( 3.14159265358 ) );
(and yes, I know pi to a lot more digits than that!)
The style you suggest is almost supported out of the box, and I've been considering fully supporting it - especially for container oriented tests.
As to the test naming - the idea is that you provide a short, hierarchical name, and a longer description (so the description is in addition to the test name):
TEST_CASE( "example/test1", "Such and such should do so and so" )
To run a test you need only specify the name (example/test1) - or a part of the name (e.g. example/*) (allowing tests to be easily grouped into suites with no extra work).