CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
test
common
test_lidar_data.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/sensor/data/LidarData.h
>
10
#include <
carla/sensor/data/SemanticLidarData.h
>
11
12
#include <vector>
13
14
using
carla::sensor::data::LidarData
;
15
using
carla::sensor::data::SemanticLidarData
;
16
17
// {Lidar,SemanticLidar}Data::ResetMemory rejects callers that supply more
18
// points-per-channel entries than the configured channel count; the equal
19
// count case is valid. These tests pin the boundary so a future tightening
20
// to a strict `>` would be caught. DEBUG_ASSERT compiles away under NDEBUG,
21
// so the assertion only fires when the suite is built as Debug.
22
23
TEST
(
LidarData
, reset_memory_accepts_one_entry_per_channel) {
24
constexpr
uint32_t channel_count{4u};
25
LidarData
data{channel_count};
26
std::vector<uint32_t> points_per_channel(channel_count, 1u);
27
data.
ResetMemory
(points_per_channel);
28
EXPECT_EQ(data.
GetChannelCount
(), channel_count);
29
}
30
31
TEST
(
LidarData
, reset_memory_accepts_fewer_entries_than_channels) {
32
constexpr
uint32_t channel_count{8u};
33
LidarData
data{channel_count};
34
std::vector<uint32_t> points_per_channel(channel_count - 2u, 3u);
35
data.
ResetMemory
(points_per_channel);
36
EXPECT_EQ(data.
GetChannelCount
(), channel_count);
37
}
38
39
TEST
(
SemanticLidarData
, reset_memory_accepts_one_entry_per_channel) {
40
constexpr
uint32_t channel_count{4u};
41
SemanticLidarData
data{channel_count};
42
std::vector<uint32_t> points_per_channel(channel_count, 1u);
43
data.
ResetMemory
(points_per_channel);
44
EXPECT_EQ(data.
GetChannelCount
(), channel_count);
45
}
46
47
TEST
(
SemanticLidarData
, reset_memory_accepts_fewer_entries_than_channels) {
48
constexpr
uint32_t channel_count{8u};
49
SemanticLidarData
data{channel_count};
50
std::vector<uint32_t> points_per_channel(channel_count - 2u, 3u);
51
data.
ResetMemory
(points_per_channel);
52
EXPECT_EQ(data.
GetChannelCount
(), channel_count);
53
}
LidarData.h
SemanticLidarData.h
carla::sensor::data::LidarData
Definition
LidarData.h:78
carla::sensor::data::LidarData::ResetMemory
virtual void ResetMemory(std::vector< uint32_t > points_per_channel)
Definition
LidarData.h:89
carla::sensor::data::SemanticLidarData
Definition
SemanticLidarData.h:86
carla::sensor::data::SemanticLidarData::ResetMemory
virtual void ResetMemory(std::vector< uint32_t > points_per_channel)
Definition
SemanticLidarData.h:118
carla::sensor::data::SemanticLidarData::GetChannelCount
uint32_t GetChannelCount() const
Definition
SemanticLidarData.h:114
test.h
TEST
TEST(agents_types, road_option_values_match_python)
Definition
test_agents.cpp:40
Generated by
1.18.0