diff --git a/packages/geom/src/bounding_box.cpp b/packages/geom/src/bounding_box.cpp index 018d995c..547bd18e 100644 --- a/packages/geom/src/bounding_box.cpp +++ b/packages/geom/src/bounding_box.cpp @@ -20,13 +20,9 @@ BoundingBox& BoundingBox::extend(double margin) noexcept { return *this; } -inline BoundingBox extend(BoundingBox& box, const geom::Vec2& v) noexcept { - return box.extend(v); -} +inline BoundingBox extend(BoundingBox& box, const geom::Vec2& v) noexcept { return box.extend(v); } -inline BoundingBox extend(BoundingBox& box, double margin) noexcept { - return box.extend(margin); -} +inline BoundingBox extend(BoundingBox& box, double margin) noexcept { return box.extend(margin); } BoundingBox makeBoundingBox(const Polygon& polygon) noexcept { VERIFY(!polygon.empty()); diff --git a/packages/geom/test/CMakeLists.txt b/packages/geom/test/CMakeLists.txt index 087dffb9..a86da00c 100644 --- a/packages/geom/test/CMakeLists.txt +++ b/packages/geom/test/CMakeLists.txt @@ -1,4 +1,5 @@ -ament_add_gtest(${PROJECT_NAME}_tests +ament_add_gtest( + ${PROJECT_NAME}_tests angle_tests.cpp angle_vector_tests.cpp arc_tests.cpp @@ -9,7 +10,8 @@ ament_add_gtest(${PROJECT_NAME}_tests ray_tests.cpp segment_tests.cpp vector_tests.cpp - vector3_tests.cpp) + vector3_tests.cpp +) target_link_libraries(${PROJECT_NAME}_tests ${PROJECT_NAME}) set_tests_properties(${Tests} PROPERTIES TIMEOUT 1) diff --git a/packages/geom/test/bounding_box_tests.cpp b/packages/geom/test/bounding_box_tests.cpp index 0252ecee..25175651 100644 --- a/packages/geom/test/bounding_box_tests.cpp +++ b/packages/geom/test/bounding_box_tests.cpp @@ -44,7 +44,7 @@ TEST(Vector3, extend) { const auto v1 = Vec2{7, 4}; const auto v2 = Vec2{-1, -8}; const auto margin = 4; - + // Act. bb1.extend(v1); bb1.extend(v2); diff --git a/packages/geom/test/vector3_tests.cpp b/packages/geom/test/vector3_tests.cpp index fb9841be..cfb90e58 100644 --- a/packages/geom/test/vector3_tests.cpp +++ b/packages/geom/test/vector3_tests.cpp @@ -37,8 +37,10 @@ TEST(Vector3, len) { const Vec3 c = {-1, 1, 0}; const Vec3 d = {2, 5, 7}; - ASSERT_GEOM_EQUAL(a.len(), std::sqrt(3), 1e-9); - ASSERT_GEOM_EQUAL(b.len(), std::sqrt(3), 1e-9); - ASSERT_GEOM_EQUAL(c.len(), std::sqrt(2), 1e-9); - ASSERT_GEOM_EQUAL(d.len(), std::sqrt(78), 1e-9); + constexpr double eps = 1e-9; + + ASSERT_GEOM_EQUAL(a.len(), std::sqrt(3), eps); + ASSERT_GEOM_EQUAL(b.len(), std::sqrt(3), eps); + ASSERT_GEOM_EQUAL(c.len(), std::sqrt(2), eps); + ASSERT_GEOM_EQUAL(d.len(), std::sqrt(78), eps); }