Use approx when testing floating point approximate equality.
This commit is contained in:
parent
369887428e
commit
782a949543
2 changed files with 5 additions and 5 deletions
|
@ -641,7 +641,7 @@ TEST_CASE("csv") {
|
|||
for (double d : { .0, +.0, 1e-06, -1e-06, 0.000001, 1.234e+16, 1.234e+16 }) {
|
||||
auto feature = fs->next();
|
||||
REQUIRE(bool(feature));
|
||||
CHECK(feature->get("floats") == d);
|
||||
CHECK(feature->get("floats").get<mapnik::value_double>() == Approx(d));
|
||||
}
|
||||
} // END SECTION
|
||||
|
||||
|
|
|
@ -98,10 +98,10 @@ SECTION("envelope multiplication") {
|
|||
auto a = mapnik::box2d<double>(100.0, 100.0, 100.001, 100.001);
|
||||
a *= 5;
|
||||
|
||||
REQUIRE(std::abs(a.minx() - 99.9980) < 0.001);
|
||||
REQUIRE(std::abs(a.miny() - 99.9980) < 0.001);
|
||||
REQUIRE(std::abs(a.maxx() - 100.0030) < 0.001);
|
||||
REQUIRE(std::abs(a.maxy() - 100.0030) < 0.001);
|
||||
REQUIRE(a.minx() == Approx( 99.9980));
|
||||
REQUIRE(a.miny() == Approx( 99.9980));
|
||||
REQUIRE(a.maxx() == Approx(100.0030));
|
||||
REQUIRE(a.maxy() == Approx(100.0030));
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue