mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Use scientific notation for the WithinULP matcher
This should now properly handle small numbers which would previously output something like `[0.00000000000000019, 0.00000000000000019]`, which does not allow user to read the numbers properly. Closes #1760
This commit is contained in:
@@ -382,8 +382,9 @@ namespace { namespace MatchersTests {
|
||||
REQUIRE_THAT(1.f, WithinULP(1.f, 0));
|
||||
|
||||
REQUIRE_THAT(nextafter(1.f, 2.f), WithinULP(1.f, 1));
|
||||
REQUIRE_THAT(nextafter(1.f, 0.f), WithinULP(1.f, 1));
|
||||
REQUIRE_THAT(nextafter(1.f, 2.f), !WithinULP(1.f, 0));
|
||||
REQUIRE_THAT(0.f, WithinULP(nextafter(0.f, 1.f), 1));
|
||||
REQUIRE_THAT(1.f, WithinULP(nextafter(1.f, 0.f), 1));
|
||||
REQUIRE_THAT(1.f, !WithinULP(nextafter(1.f, 2.f), 0));
|
||||
|
||||
REQUIRE_THAT(1.f, WithinULP(1.f, 0));
|
||||
REQUIRE_THAT(-0.f, WithinULP(0.f, 0));
|
||||
@@ -437,8 +438,9 @@ namespace { namespace MatchersTests {
|
||||
REQUIRE_THAT(1., WithinULP(1., 0));
|
||||
|
||||
REQUIRE_THAT(nextafter(1., 2.), WithinULP(1., 1));
|
||||
REQUIRE_THAT(nextafter(1., 0.), WithinULP(1., 1));
|
||||
REQUIRE_THAT(nextafter(1., 2.), !WithinULP(1., 0));
|
||||
REQUIRE_THAT(0., WithinULP(nextafter(0., 1.), 1));
|
||||
REQUIRE_THAT(1., WithinULP(nextafter(1., 0.), 1));
|
||||
REQUIRE_THAT(1., !WithinULP(nextafter(1., 2.), 0));
|
||||
|
||||
REQUIRE_THAT(1., WithinULP(1., 0));
|
||||
REQUIRE_THAT(-0., WithinULP(0., 0));
|
||||
|
Reference in New Issue
Block a user