Skip to content

Commit f1eb2d7

Browse files
authored
fix(autoware_universe_utils): fix test for boost geometry (#12372)
* fix(autoware_universe_utils): fix test for boost geometry Signed-off-by: Ryohsuke Mitsudome <ryohsuke.mitsudome@tier4.jp>
1 parent 6f9a080 commit f1eb2d7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

common/autoware_universe_utils/test/src/geometry/test_geometry.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <boost/geometry/algorithms/distance.hpp>
3030
#include <boost/geometry/algorithms/union.hpp>
3131
#include <boost/geometry/io/wkt/write.hpp>
32+
#include <boost/version.hpp>
3233

3334
#include <gtest/gtest.h>
3435

@@ -2700,10 +2701,16 @@ TEST(geometry, UnionDifferenceIntersectPolygon)
27002701
std::vector<autoware::universe_utils::Polygon2d> boost_difference_result(
27012702
boost_difference_resultMP.begin(), boost_difference_resultMP.end());
27022703

2704+
#if BOOST_VERSION >= 108300 // Boost 1.83+ fixed precision issues in polygon boolean operations
2705+
EXPECT_TRUE(polygon_equal_vector(custom_union_poly, boost_union_result, epsilon));
2706+
EXPECT_TRUE(polygon_equal_vector(custom_intersection_poly, boost_intersection_result, epsilon));
2707+
EXPECT_TRUE(polygon_equal_vector(custom_difference_poly, boost_difference_result, epsilon));
2708+
#else
27032709
EXPECT_FALSE(polygon_equal_vector(custom_union_poly, boost_union_result, epsilon));
27042710
EXPECT_FALSE(
27052711
polygon_equal_vector(custom_intersection_poly, boost_intersection_result, epsilon));
27062712
EXPECT_FALSE(polygon_equal_vector(custom_difference_poly, boost_difference_result, epsilon));
2713+
#endif
27072714
}
27082715

27092716
{ // case where Boost.Geometry omits a very small polygon in the difference result, while Shapely

0 commit comments

Comments
 (0)