CARLA
Loading...
Searching...
No Matches
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
11
12#include <vector>
13
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
23TEST(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
31TEST(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
39TEST(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
47TEST(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}
TEST(LidarData, reset_memory_accepts_one_entry_per_channel)