From bb2f792e7fed735787f7790d30868430563bb791 Mon Sep 17 00:00:00 2001 From: Zhe Shen Date: Wed, 11 Dec 2024 07:35:27 +0900 Subject: [PATCH 1/3] lanelet length test added. Signed-off-by: Zhe Shen --- autoware_lanelet2_extension/test/src/test_utilities.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/autoware_lanelet2_extension/test/src/test_utilities.cpp b/autoware_lanelet2_extension/test/src/test_utilities.cpp index 23e159b..ac2f216 100644 --- a/autoware_lanelet2_extension/test/src/test_utilities.cpp +++ b/autoware_lanelet2_extension/test/src/test_utilities.cpp @@ -158,6 +158,15 @@ TEST_F(TestSuite, OverwriteLaneletsCenterline) // NOLINT for gtest } } +TEST_F(TestSuite, GetLaneletLength) // NOLINT for gtest +{ + double length_2d = lanelet::utils::getLaneletLength2d(road_lanelet); + double length_3d = lanelet::utils::getLaneletLength3d(road_lanelet); + + EXPECT_GT(length_2d, 0.0); + EXPECT_GT(length_3d, 0.0); +} + /* TEST(Utilities, copyZ) // NOLINT for gtest { From 0bb9c5c2c9447cc48df99be4df3b622d9812bd53 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:43:27 +0000 Subject: [PATCH 2/3] style(pre-commit): autofix --- autoware_lanelet2_extension/test/src/test_utilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoware_lanelet2_extension/test/src/test_utilities.cpp b/autoware_lanelet2_extension/test/src/test_utilities.cpp index ac2f216..54114e8 100644 --- a/autoware_lanelet2_extension/test/src/test_utilities.cpp +++ b/autoware_lanelet2_extension/test/src/test_utilities.cpp @@ -158,7 +158,7 @@ TEST_F(TestSuite, OverwriteLaneletsCenterline) // NOLINT for gtest } } -TEST_F(TestSuite, GetLaneletLength) // NOLINT for gtest +TEST_F(TestSuite, GetLaneletLength) // NOLINT for gtest { double length_2d = lanelet::utils::getLaneletLength2d(road_lanelet); double length_3d = lanelet::utils::getLaneletLength3d(road_lanelet); From fd97b01e67e2a3a537580b5961dec70798a2eb06 Mon Sep 17 00:00:00 2001 From: Zhe Shen Date: Thu, 12 Dec 2024 23:26:32 +0100 Subject: [PATCH 3/3] compare the precise values Signed-off-by: Zhe Shen --- autoware_lanelet2_extension/test/src/test_utilities.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoware_lanelet2_extension/test/src/test_utilities.cpp b/autoware_lanelet2_extension/test/src/test_utilities.cpp index 54114e8..7e7fccc 100644 --- a/autoware_lanelet2_extension/test/src/test_utilities.cpp +++ b/autoware_lanelet2_extension/test/src/test_utilities.cpp @@ -163,8 +163,8 @@ TEST_F(TestSuite, GetLaneletLength) // NOLINT for gtest double length_2d = lanelet::utils::getLaneletLength2d(road_lanelet); double length_3d = lanelet::utils::getLaneletLength3d(road_lanelet); - EXPECT_GT(length_2d, 0.0); - EXPECT_GT(length_3d, 0.0); + EXPECT_DOUBLE_EQ(length_2d, 1.0); + EXPECT_DOUBLE_EQ(length_3d, 1.0); } /*