diff --git a/controller_interface/test/test_led_rgb_device.cpp b/controller_interface/test/test_led_rgb_device.cpp index 71550fd7c3..9261fac137 100644 --- a/controller_interface/test/test_led_rgb_device.cpp +++ b/controller_interface/test/test_led_rgb_device.cpp @@ -84,3 +84,22 @@ TEST_F(LedDeviceTest, validate_all) led_device_->release_interfaces(); ASSERT_EQ(led_device_->command_interfaces_.size(), 0); } + +TEST_F(LedDeviceTest, validate_custom_names) +{ + std::string interface_name_r = "led/custom_r"; + std::string interface_name_g = "led/custom_g"; + std::string interface_name_b = "led/custom_b"; + // Create device + led_device_ = + std::make_unique(interface_name_r, interface_name_g, interface_name_b); + EXPECT_EQ(led_device_->name_, ""); + + EXPECT_EQ(led_device_->interface_names_.size(), size_); + EXPECT_EQ(led_device_->command_interfaces_.capacity(), size_); + + // Validate custom interface_names_ + EXPECT_EQ(led_device_->interface_names_[0], interface_name_r); + EXPECT_EQ(led_device_->interface_names_[1], interface_name_g); + EXPECT_EQ(led_device_->interface_names_[2], interface_name_b); +} diff --git a/controller_interface/test/test_led_rgb_device.hpp b/controller_interface/test/test_led_rgb_device.hpp index 525244572f..2e673eed8b 100644 --- a/controller_interface/test/test_led_rgb_device.hpp +++ b/controller_interface/test/test_led_rgb_device.hpp @@ -28,11 +28,19 @@ class TestableLedDevice : public semantic_components::LEDRgbDevice { FRIEND_TEST(LedDeviceTest, validate_all); + FRIEND_TEST(LedDeviceTest, validate_custom_names); public: // Use default command interface names explicit TestableLedDevice(const std::string & name) : LEDRgbDevice{name} {} + TestableLedDevice( + const std::string & interface_r, const std::string & interface_g, + const std::string & interface_b) + : LEDRgbDevice{interface_r, interface_g, interface_b} + { + } + virtual ~TestableLedDevice() = default; };