From 14d0f9cbf0a1554db0bd8512c1bbec98ca759540 Mon Sep 17 00:00:00 2001 From: Muhammad Zulfaqar Azmi Date: Thu, 9 May 2024 21:09:06 +0900 Subject: [PATCH] Added test for isHandlerReady Signed-off-by: Muhammad Zulfaqar Azmi --- planning/route_handler/CMakeLists.txt | 4 +++- planning/route_handler/test/test_route_handler.cpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/planning/route_handler/CMakeLists.txt b/planning/route_handler/CMakeLists.txt index 05370f1ec8f53..78d1736f8f17a 100644 --- a/planning/route_handler/CMakeLists.txt +++ b/planning/route_handler/CMakeLists.txt @@ -26,7 +26,9 @@ if(BUILD_TESTING) route_parser) target_link_libraries(test_route_handler - route_handler) + route_handler + route_parser + ) endif() diff --git a/planning/route_handler/test/test_route_handler.cpp b/planning/route_handler/test/test_route_handler.cpp index 8a8230669ec79..16a80debbfb80 100644 --- a/planning/route_handler/test/test_route_handler.cpp +++ b/planning/route_handler/test/test_route_handler.cpp @@ -14,15 +14,22 @@ #include "test_route_handler.hpp" +#include "route_parser.hpp" + #include #include namespace route_handler::test { -TEST_F(TestRouteHandler, testSomething) +TEST_F(TestRouteHandler, isRouteHandlerReadyTest) { - ASSERT_EQ(1, 1); + const auto planning_test_utils_dir = + ament_index_cpp::get_package_share_directory("route_handler"); + const auto rh_test_route = planning_test_utils_dir + "/test_route/rh_test.route"; + ASSERT_FALSE(route_handler_->isHandlerReady()); + route_handler_->setRoute(parse_route_file(rh_test_route)); + ASSERT_TRUE(route_handler_->isHandlerReady()); } int main(int argc, char * argv[])