CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
test
common
test_ros2_subscriber_lifetime.cpp
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#include "
test.h
"
8
9
#include <
carla/ros2/subscribers/AckermannControlSubscriber.h
>
10
#include <
carla/ros2/subscribers/CarlaEgoVehicleControlSubscriber.h
>
11
12
#include <type_traits>
13
14
// The ROS 2 control subscribers are polymorphic and always owned through a
15
// std::shared_ptr<BaseSubscriber>, so copying or moving one would slice the derived
16
// object. BaseSubscriber deliberately = deletes its copy/move members; these concrete
17
// subscribers are non-abstract, so the assertions below only hold while that contract
18
// propagates. A revert of the base back to = default would make them copyable again and
19
// trip this test at build and run time.
20
static_assert
(
21
!std::is_copy_constructible_v<carla::ros2::AckermannControlSubscriber>,
22
"AckermannControlSubscriber must stay non-copyable to avoid slicing"
);
23
static_assert
(
24
!std::is_move_constructible_v<carla::ros2::AckermannControlSubscriber>,
25
"AckermannControlSubscriber must stay non-movable to avoid slicing"
);
26
static_assert
(
27
!std::is_copy_constructible_v<carla::ros2::CarlaEgoVehicleControlSubscriber>,
28
"CarlaEgoVehicleControlSubscriber must stay non-copyable to avoid slicing"
);
29
static_assert
(
30
!std::is_move_constructible_v<carla::ros2::CarlaEgoVehicleControlSubscriber>,
31
"CarlaEgoVehicleControlSubscriber must stay non-movable to avoid slicing"
);
32
33
TEST
(ros2_subscriber_lifetime, control_subscribers_are_non_copyable) {
34
EXPECT_FALSE(std::is_copy_constructible_v<carla::ros2::AckermannControlSubscriber>);
35
EXPECT_FALSE(std::is_move_constructible_v<carla::ros2::AckermannControlSubscriber>);
36
EXPECT_FALSE(std::is_copy_constructible_v<carla::ros2::CarlaEgoVehicleControlSubscriber>);
37
EXPECT_FALSE(std::is_move_constructible_v<carla::ros2::CarlaEgoVehicleControlSubscriber>);
38
}
AckermannControlSubscriber.h
CarlaEgoVehicleControlSubscriber.h
test.h
TEST
TEST(agents_types, road_option_values_match_python)
Definition
test_agents.cpp:40
Generated by
1.18.0