- // Because areas vary hugely in buffer, the Boost.Test methods are not convenient.
- // Use just the abs - but if areas are really small that is not convenient neither.
- // Therefore there is a logarithmic option too.
- typename bg::default_area_result<GeometryOut>::type area = bg::area(buffered, area_strategy);
- double const difference = settings.use_ln_area
- ? std::log(area) - std::log(expected_area)
- : area - expected_area;
- BOOST_CHECK_MESSAGE
- (
- bg::math::abs(difference) < settings.tolerance,
- complete.str() << " not as expected. "
- << std::setprecision(18)
- << " Expected: " << expected_area
- << " Detected: " << area
- << " Diff: " << difference
- << " Tol: " << settings.tolerance
- << std::setprecision(3)
- << " , " << 100.0 * (difference / expected_area) << "%"
- );
-// if (settings.use_ln_area)
-// {
-// std::cout << complete.str()
-// << std::setprecision(6)
-// << " ln(detected)=" << std::log(area)
-// << " ln(expected)=" << std::log(expected_area)
-// << " diff=" << difference
-// << " detected=" << area
-// << std::endl;
-// }
+ typename bg::default_area_result<GeometryOut>::type area
+ = bg::area(buffered, area_strategy);
+ BOOST_CHECK_MESSAGE(expected_area.contains(area, settings.tolerance, settings.use_ln_area),
+ "difference: " << caseid << std::setprecision(20)
+ << " #area expected: " << expected_area
+ << " detected: " << area
+ << " type: " << (type_for_assert_message<Geometry, GeometryOut>())
+ );