Skip to content

Commit 959b8a9

Browse files
Added additional test
Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
1 parent f0e7eba commit 959b8a9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

planning/route_handler/test/test_route_handler.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@ TEST_F(TestRouteHandler, isRouteHandlerReadyTest)
3232
ASSERT_TRUE(route_handler_->isHandlerReady());
3333
}
3434

35-
int main(int argc, char * argv[])
35+
TEST_F(TestRouteHandler, checkIfIDReturned)
3636
{
37-
testing::InitGoogleTest(&argc, argv);
38-
rclcpp::init(argc, argv);
39-
bool result = RUN_ALL_TESTS();
40-
rclcpp::shutdown();
41-
return result;
37+
const auto planning_test_utils_dir =
38+
ament_index_cpp::get_package_share_directory("route_handler");
39+
const auto rh_test_route = planning_test_utils_dir + "/test_route/rh_test.route";
40+
41+
route_handler_->setRoute(parse_route_file(rh_test_route));
42+
const auto lanelet = route_handler_->getLaneletsFromId(4870);
43+
44+
const auto is_in_goal_route_section = route_handler_->isInGoalRouteSection(lanelet);
45+
46+
ASSERT_TRUE(is_in_goal_route_section);
4247
}
4348
} // namespace route_handler::test

planning/route_handler/test/test_route_parser.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,4 @@ TEST(ParseFunction, CompleteFromFilename)
130130
EXPECT_EQ(segment1.primitives[3].id, 88);
131131
EXPECT_EQ(segment1.primitives[3].primitive_type, "lane");
132132
}
133-
int main(int argc, char ** argv)
134-
{
135-
::testing::InitGoogleTest(&argc, argv);
136-
return RUN_ALL_TESTS();
137-
}
138133
} // namespace route_handler::test

0 commit comments

Comments
 (0)