Branch data Line data Source code
1 : : /*
2 : : * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3 : : *
4 : : * Copyright (C) 2018-2022 Intel Corporation
5 : : *
6 : : * SPDX-License-Identifier: LGPL-2.1-only
7 : : *
8 : : * ----------------- END LICENSE BLOCK -----------------------------------
9 : : */
10 : :
11 : : /*
12 : : * Generated file
13 : : */
14 : :
15 : : #if defined(__clang__) && (__clang_major__ >= 7)
16 : : #pragma GCC diagnostic push
17 : : #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
18 : : #endif
19 : :
20 : : #include <gtest/gtest.h>
21 : : #include <limits>
22 : : #include "ad/rss/world/UnstructuredSettings.hpp"
23 : :
24 : : class UnstructuredSettingsTests : public testing::Test
25 : : {
26 : : protected:
27 : 21 : virtual void SetUp() override
28 : : {
29 : : // valid initialization
30 : 21 : ::ad::rss::world::UnstructuredSettings value;
31 : 21 : ::ad::physics::Distance valuePedestrian_turning_radius(-1e9);
32 : 21 : value.pedestrian_turning_radius = valuePedestrian_turning_radius;
33 : 21 : ::ad::physics::Angle valueDrive_away_max_angle(-6.283185308);
34 : 21 : value.drive_away_max_angle = valueDrive_away_max_angle;
35 : 21 : ::ad::physics::AngularAcceleration valueVehicle_yaw_rate_change(-1e2);
36 : 21 : value.vehicle_yaw_rate_change = valueVehicle_yaw_rate_change;
37 : 21 : ::ad::physics::Distance valueVehicle_min_radius(-1e9);
38 : 21 : value.vehicle_min_radius = valueVehicle_min_radius;
39 : 21 : ::ad::physics::Duration valueVehicle_trajectory_calculation_step(0.);
40 : 21 : value.vehicle_trajectory_calculation_step = valueVehicle_trajectory_calculation_step;
41 : 21 : uint32_t valueVehicle_front_intermediate_yaw_rate_change_ratio_steps{std::numeric_limits<uint32_t>::min()};
42 : : value.vehicle_front_intermediate_yaw_rate_change_ratio_steps
43 : 21 : = valueVehicle_front_intermediate_yaw_rate_change_ratio_steps;
44 : 21 : uint32_t valueVehicle_back_intermediate_yaw_rate_change_ratio_steps{std::numeric_limits<uint32_t>::min()};
45 : : value.vehicle_back_intermediate_yaw_rate_change_ratio_steps
46 : 21 : = valueVehicle_back_intermediate_yaw_rate_change_ratio_steps;
47 : 21 : uint32_t valueVehicle_brake_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::min()};
48 : 21 : value.vehicle_brake_intermediate_acceleration_steps = valueVehicle_brake_intermediate_acceleration_steps;
49 : 21 : uint32_t valueVehicle_continue_forward_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::min()};
50 : : value.vehicle_continue_forward_intermediate_acceleration_steps
51 : 21 : = valueVehicle_continue_forward_intermediate_acceleration_steps;
52 : 21 : uint32_t valueVehicle_continue_forward_intermediate_yaw_rate_change_ratio_steps{
53 : : std::numeric_limits<uint32_t>::min()};
54 : : value.vehicle_continue_forward_intermediate_yaw_rate_change_ratio_steps
55 : 21 : = valueVehicle_continue_forward_intermediate_yaw_rate_change_ratio_steps;
56 : 21 : uint32_t valuePedestrian_continue_forward_intermediate_heading_change_ratio_steps{
57 : : std::numeric_limits<uint32_t>::min()};
58 : : value.pedestrian_continue_forward_intermediate_heading_change_ratio_steps
59 : 21 : = valuePedestrian_continue_forward_intermediate_heading_change_ratio_steps;
60 : 21 : uint32_t valuePedestrian_continue_forward_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::min()};
61 : : value.pedestrian_continue_forward_intermediate_acceleration_steps
62 : 21 : = valuePedestrian_continue_forward_intermediate_acceleration_steps;
63 : 21 : uint32_t valuePedestrian_brake_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::min()};
64 : 21 : value.pedestrian_brake_intermediate_acceleration_steps = valuePedestrian_brake_intermediate_acceleration_steps;
65 : 21 : uint32_t valuePedestrian_front_intermediate_heading_change_ratio_steps{std::numeric_limits<uint32_t>::min()};
66 : : value.pedestrian_front_intermediate_heading_change_ratio_steps
67 : 21 : = valuePedestrian_front_intermediate_heading_change_ratio_steps;
68 : 21 : uint32_t valuePedestrian_back_intermediate_heading_change_ratio_steps{std::numeric_limits<uint32_t>::min()};
69 : : value.pedestrian_back_intermediate_heading_change_ratio_steps
70 : 21 : = valuePedestrian_back_intermediate_heading_change_ratio_steps;
71 : 21 : mValue = value;
72 : 21 : }
73 : :
74 : : ::ad::rss::world::UnstructuredSettings mValue;
75 : : };
76 : :
77 : 4 : TEST_F(UnstructuredSettingsTests, copyConstruction)
78 : : {
79 : 1 : ::ad::rss::world::UnstructuredSettings value(mValue);
80 [ + - - + : 1 : EXPECT_EQ(mValue, value);
- - - - -
- ]
81 : 1 : }
82 : :
83 : 4 : TEST_F(UnstructuredSettingsTests, moveConstruction)
84 : : {
85 : 1 : ::ad::rss::world::UnstructuredSettings tmpValue(mValue);
86 : 1 : ::ad::rss::world::UnstructuredSettings value(std::move(tmpValue));
87 [ + - - + : 1 : EXPECT_EQ(mValue, value);
- - - - -
- ]
88 : 1 : }
89 : :
90 : 4 : TEST_F(UnstructuredSettingsTests, copyAssignment)
91 : : {
92 : 1 : ::ad::rss::world::UnstructuredSettings value;
93 : 1 : value = mValue;
94 [ + - - + : 1 : EXPECT_EQ(mValue, value);
- - - - -
- ]
95 : 1 : }
96 : :
97 : 4 : TEST_F(UnstructuredSettingsTests, moveAssignment)
98 : : {
99 : 1 : ::ad::rss::world::UnstructuredSettings tmpValue(mValue);
100 : 1 : ::ad::rss::world::UnstructuredSettings value;
101 : 1 : value = std::move(tmpValue);
102 [ + - - + : 1 : EXPECT_EQ(mValue, value);
- - - - -
- ]
103 : 1 : }
104 : :
105 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorEqual)
106 : : {
107 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
108 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
109 : :
110 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB);
- - - - -
- - - ]
111 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB);
- - - - -
- - - ]
112 : 1 : }
113 : :
114 : 4 : TEST_F(UnstructuredSettingsTests, stringConversionTest)
115 : : {
116 [ + - ]: 1 : std::stringstream stream;
117 [ + - ]: 1 : stream << mValue;
118 [ + - ]: 1 : std::string ostreamStr = stream.str();
119 [ + - ]: 1 : std::string toStr = std::to_string(mValue);
120 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr);
- - - - -
- + - ]
121 [ + - + - : 1 : }
+ - ]
122 : :
123 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorPedestrian_turning_radiusDiffers)
124 : : {
125 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
126 : 1 : ::ad::physics::Distance pedestrian_turning_radius(1e9);
127 : 1 : valueA.pedestrian_turning_radius = pedestrian_turning_radius;
128 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
129 : :
130 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
131 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
132 : 1 : }
133 : :
134 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorDrive_away_max_angleDiffers)
135 : : {
136 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
137 : 1 : ::ad::physics::Angle drive_away_max_angle(6.283185308);
138 : 1 : valueA.drive_away_max_angle = drive_away_max_angle;
139 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
140 : :
141 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
142 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
143 : 1 : }
144 : :
145 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorVehicle_yaw_rate_changeDiffers)
146 : : {
147 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
148 : 1 : ::ad::physics::AngularAcceleration vehicle_yaw_rate_change(1e2);
149 : 1 : valueA.vehicle_yaw_rate_change = vehicle_yaw_rate_change;
150 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
151 : :
152 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
153 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
154 : 1 : }
155 : :
156 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorVehicle_min_radiusDiffers)
157 : : {
158 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
159 : 1 : ::ad::physics::Distance vehicle_min_radius(1e9);
160 : 1 : valueA.vehicle_min_radius = vehicle_min_radius;
161 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
162 : :
163 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
164 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
165 : 1 : }
166 : :
167 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorVehicle_trajectory_calculation_stepDiffers)
168 : : {
169 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
170 : 1 : ::ad::physics::Duration vehicle_trajectory_calculation_step(1e6);
171 : 1 : valueA.vehicle_trajectory_calculation_step = vehicle_trajectory_calculation_step;
172 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
173 : :
174 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
175 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
176 : 1 : }
177 : :
178 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorVehicle_front_intermediate_yaw_rate_change_ratio_stepsDiffers)
179 : : {
180 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
181 : 1 : uint32_t vehicle_front_intermediate_yaw_rate_change_ratio_steps{std::numeric_limits<uint32_t>::max()};
182 : : valueA.vehicle_front_intermediate_yaw_rate_change_ratio_steps
183 : 1 : = vehicle_front_intermediate_yaw_rate_change_ratio_steps;
184 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
185 : :
186 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
187 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
188 : 1 : }
189 : :
190 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorVehicle_back_intermediate_yaw_rate_change_ratio_stepsDiffers)
191 : : {
192 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
193 : 1 : uint32_t vehicle_back_intermediate_yaw_rate_change_ratio_steps{std::numeric_limits<uint32_t>::max()};
194 : 1 : valueA.vehicle_back_intermediate_yaw_rate_change_ratio_steps = vehicle_back_intermediate_yaw_rate_change_ratio_steps;
195 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
196 : :
197 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
198 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
199 : 1 : }
200 : :
201 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorVehicle_brake_intermediate_acceleration_stepsDiffers)
202 : : {
203 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
204 : 1 : uint32_t vehicle_brake_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::max()};
205 : 1 : valueA.vehicle_brake_intermediate_acceleration_steps = vehicle_brake_intermediate_acceleration_steps;
206 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
207 : :
208 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
209 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
210 : 1 : }
211 : :
212 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorVehicle_continue_forward_intermediate_acceleration_stepsDiffers)
213 : : {
214 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
215 : 1 : uint32_t vehicle_continue_forward_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::max()};
216 : : valueA.vehicle_continue_forward_intermediate_acceleration_steps
217 : 1 : = vehicle_continue_forward_intermediate_acceleration_steps;
218 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
219 : :
220 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
221 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
222 : 1 : }
223 : :
224 : 4 : TEST_F(UnstructuredSettingsTests,
225 : : comparisonOperatorVehicle_continue_forward_intermediate_yaw_rate_change_ratio_stepsDiffers)
226 : : {
227 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
228 : 1 : uint32_t vehicle_continue_forward_intermediate_yaw_rate_change_ratio_steps{std::numeric_limits<uint32_t>::max()};
229 : : valueA.vehicle_continue_forward_intermediate_yaw_rate_change_ratio_steps
230 : 1 : = vehicle_continue_forward_intermediate_yaw_rate_change_ratio_steps;
231 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
232 : :
233 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
234 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
235 : 1 : }
236 : :
237 : 4 : TEST_F(UnstructuredSettingsTests,
238 : : comparisonOperatorPedestrian_continue_forward_intermediate_heading_change_ratio_stepsDiffers)
239 : : {
240 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
241 : 1 : uint32_t pedestrian_continue_forward_intermediate_heading_change_ratio_steps{std::numeric_limits<uint32_t>::max()};
242 : : valueA.pedestrian_continue_forward_intermediate_heading_change_ratio_steps
243 : 1 : = pedestrian_continue_forward_intermediate_heading_change_ratio_steps;
244 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
245 : :
246 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
247 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
248 : 1 : }
249 : :
250 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorPedestrian_continue_forward_intermediate_acceleration_stepsDiffers)
251 : : {
252 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
253 : 1 : uint32_t pedestrian_continue_forward_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::max()};
254 : : valueA.pedestrian_continue_forward_intermediate_acceleration_steps
255 : 1 : = pedestrian_continue_forward_intermediate_acceleration_steps;
256 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
257 : :
258 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
259 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
260 : 1 : }
261 : :
262 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorPedestrian_brake_intermediate_acceleration_stepsDiffers)
263 : : {
264 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
265 : 1 : uint32_t pedestrian_brake_intermediate_acceleration_steps{std::numeric_limits<uint32_t>::max()};
266 : 1 : valueA.pedestrian_brake_intermediate_acceleration_steps = pedestrian_brake_intermediate_acceleration_steps;
267 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
268 : :
269 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
270 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
271 : 1 : }
272 : :
273 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorPedestrian_front_intermediate_heading_change_ratio_stepsDiffers)
274 : : {
275 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
276 : 1 : uint32_t pedestrian_front_intermediate_heading_change_ratio_steps{std::numeric_limits<uint32_t>::max()};
277 : : valueA.pedestrian_front_intermediate_heading_change_ratio_steps
278 : 1 : = pedestrian_front_intermediate_heading_change_ratio_steps;
279 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
280 : :
281 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
282 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
283 : 1 : }
284 : :
285 : 4 : TEST_F(UnstructuredSettingsTests, comparisonOperatorPedestrian_back_intermediate_heading_change_ratio_stepsDiffers)
286 : : {
287 : 1 : ::ad::rss::world::UnstructuredSettings valueA = mValue;
288 : 1 : uint32_t pedestrian_back_intermediate_heading_change_ratio_steps{std::numeric_limits<uint32_t>::max()};
289 : : valueA.pedestrian_back_intermediate_heading_change_ratio_steps
290 : 1 : = pedestrian_back_intermediate_heading_change_ratio_steps;
291 : 1 : ::ad::rss::world::UnstructuredSettings valueB = mValue;
292 : :
293 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB);
- - - - -
- - - ]
294 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB);
- - - - -
- - - ]
295 : 1 : }
296 : :
297 : : #if defined(__clang__) && (__clang_major__ >= 7)
298 : : #pragma GCC diagnostic pop
299 : : #endif
|