From 130f537f17c66064bd5ad351bf2983914ddebcf9 Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Wed, 12 Aug 2026 00:11:02 -0700 Subject: [PATCH 1/2] fix: catch tests on jazzy+ --- CMakeLists.txt | 26 +++++++++++--------------- test/test_radar_layer.cpp | 13 ++++++++++--- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8641a5d..c9eb940 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,15 +30,6 @@ find_package(message_filters REQUIRED) find_package(tf2_ros REQUIRED) find_package(nav2_dynamic_msgs REQUIRED) -set(dep_pkgs - rclcpp - nav2_costmap_2d - pluginlib - radar_msgs - message_filters - tf2_ros - nav2_dynamic_msgs) - # === Build === include_directories(include) @@ -46,7 +37,14 @@ include_directories(include) add_library(${lib_name} SHARED src/radar_layer.cpp) -ament_target_dependencies(${lib_name} ${dep_pkgs}) +ament_target_dependencies(${lib_name} + rclcpp + nav2_costmap_2d + pluginlib + radar_msgs + message_filters + tf2_ros + nav2_dynamic_msgs) # === Installation === @@ -65,15 +63,14 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() # Unit Test - find_package(Catch2 2 REQUIRED) + find_package(Catch2 REQUIRED) set(test_dependencies Catch2 ) add_executable(catch_tests test/test_radar_layer.cpp) - target_link_libraries(catch_tests Catch2::Catch2 ${lib_name}) + target_link_libraries(catch_tests Catch2::Catch2WithMain ${lib_name}) ament_target_dependencies(catch_tests - ${test_dependencies} - ${dep_pkgs} + ${lib_name} ) add_test(NAME catch_tests COMMAND catch_tests) endif() @@ -83,5 +80,4 @@ endif() # This allows the plugin to be discovered as a plugin of required type. pluginlib_export_plugin_description_file(nav2_costmap_2d radar_layer.xml) -ament_target_dependencies(${lib_name} ${dep_pkgs}) ament_package() diff --git a/test/test_radar_layer.cpp b/test/test_radar_layer.cpp index 83c10e1..1667932 100644 --- a/test/test_radar_layer.cpp +++ b/test/test_radar_layer.cpp @@ -1,8 +1,15 @@ -#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do - // this in one cpp file +#define CATCH_CONFIG_MAIN #include -#include +#if __has_include() + #include + #include +using Catch::Approx; +#elif __has_include() + #include +#else + #error "Catch2 headers not found. Please install Catch2 (v2 or v3)." +#endif #include #include #include From ebe9ce5476847a2e50adb5de9e9df218f3635705 Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Wed, 12 Aug 2026 10:19:36 -0700 Subject: [PATCH 2/2] not ament dep --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9eb940..180dc7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,9 +69,6 @@ if(BUILD_TESTING) ) add_executable(catch_tests test/test_radar_layer.cpp) target_link_libraries(catch_tests Catch2::Catch2WithMain ${lib_name}) - ament_target_dependencies(catch_tests - ${lib_name} - ) add_test(NAME catch_tests COMMAND catch_tests) endif()