From 28378fe5a2847d6491cf5973e92bb1878b2dc81f Mon Sep 17 00:00:00 2001 From: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> Date: Mon, 24 Aug 2026 04:12:32 +0530 Subject: [PATCH] fix: test: add unit tests for create_callback_group_id - tests\test_create_callback_group_id.cpp - cie_thread_configurator\CMakeLists.txt Fixes #38 Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> --- cie_thread_configurator/CMakeLists.txt | 3 +++ tests/test_create_callback_group_id.cpp | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/test_create_callback_group_id.cpp diff --git a/cie_thread_configurator/CMakeLists.txt b/cie_thread_configurator/CMakeLists.txt index 988d85a..c028201 100644 --- a/cie_thread_configurator/CMakeLists.txt +++ b/cie_thread_configurator/CMakeLists.txt @@ -82,3 +82,6 @@ if(BUILD_TESTING) endif() ament_package() + +ament_add_ros_isolated_gtest(test_create_callback_group_id test/test_create_callback_group_id.cpp) +target_link_libraries(test_create_callback_group_id ${PROJECT_NAME}) diff --git a/tests/test_create_callback_group_id.cpp b/tests/test_create_callback_group_id.cpp new file mode 100644 index 0000000..b1dfa67 --- /dev/null +++ b/tests/test_create_callback_group_id.cpp @@ -0,0 +1,17 @@ +#include +#include +#include + +#include "cie_thread_configurator/cie_thread_configurator.hpp" + +TEST(CreateCallbackGroupId, DeterministicAndDistinct) { + using ::cie_thread_configurator::create_callback_group_id; + // Exercise the pure string-ID helper with simple inputs. + // Parameter types follow the declaration in the project header. + auto id1 = create_callback_group_id("v1_0", "v1_1"); + auto id2 = create_callback_group_id("v1_0", "v1_1"); + auto id3 = create_callback_group_id("v2_0", "v2_1"); + EXPECT_EQ(id1, id2); + EXPECT_NE(id1, id3); + EXPECT_FALSE(id1.empty()); +}