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/state/RssState.hpp" 23 : : 24 : : class RssStateTests : public testing::Test 25 : : { 26 : : protected: 27 : 14 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 14 : ::ad::rss::state::RssState value; 31 : 14 : ::ad::rss::world::ObjectId valueEgo_id(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 32 : 14 : value.ego_id = valueEgo_id; 33 : 14 : ::ad::rss::world::ObjectId valueObject_id(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 34 : 14 : value.object_id = valueObject_id; 35 : 14 : ::ad::rss::core::RelativeConstellationId valueConstellation_id( 36 : : std::numeric_limits<::ad::rss::core::RelativeConstellationId>::lowest()); 37 : 14 : value.constellation_id = valueConstellation_id; 38 : 14 : ::ad::rss::state::LongitudinalRssState valueLongitudinal_state; 39 : 14 : bool valueLongitudinal_stateIs_safe{true}; 40 : 14 : valueLongitudinal_state.is_safe = valueLongitudinal_stateIs_safe; 41 : 14 : ::ad::rss::state::LongitudinalResponse valueLongitudinal_stateResponse( 42 : : ::ad::rss::state::LongitudinalResponse::None); 43 : 14 : valueLongitudinal_state.response = valueLongitudinal_stateResponse; 44 : 14 : ::ad::rss::world::LongitudinalRssAccelerationValues valueLongitudinal_stateAlpha_lon; 45 : 14 : ::ad::physics::Acceleration valueLongitudinal_stateAlpha_lonAccel_max(-1e2); 46 : 14 : valueLongitudinal_stateAlpha_lonAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 47 : 14 : valueLongitudinal_stateAlpha_lon.accel_max = valueLongitudinal_stateAlpha_lonAccel_max; 48 : 14 : ::ad::physics::Acceleration valueLongitudinal_stateAlpha_lonBrake_max(-1e2); 49 : 14 : valueLongitudinal_stateAlpha_lon.brake_max = valueLongitudinal_stateAlpha_lonBrake_max; 50 : 14 : ::ad::physics::Acceleration valueLongitudinal_stateAlpha_lonBrake_min(-1e2); 51 : 14 : valueLongitudinal_stateAlpha_lon.brake_min = valueLongitudinal_stateAlpha_lonBrake_min; 52 : 14 : ::ad::physics::Acceleration valueLongitudinal_stateAlpha_lonBrake_min_correct(-1e2); 53 : 14 : valueLongitudinal_stateAlpha_lon.brake_min_correct = valueLongitudinal_stateAlpha_lonBrake_min_correct; 54 : 14 : valueLongitudinal_stateAlpha_lon.brake_min = valueLongitudinal_stateAlpha_lon.brake_max; 55 : 14 : valueLongitudinal_stateAlpha_lon.brake_min_correct = valueLongitudinal_stateAlpha_lon.brake_min; 56 : 14 : valueLongitudinal_stateAlpha_lon.brake_min = valueLongitudinal_stateAlpha_lon.brake_min_correct; 57 : 14 : valueLongitudinal_stateAlpha_lon.brake_max = valueLongitudinal_stateAlpha_lon.brake_min; 58 : 14 : valueLongitudinal_state.alpha_lon = valueLongitudinal_stateAlpha_lon; 59 : 14 : ::ad::rss::state::RssStateInformation valueLongitudinal_stateRss_state_information; 60 : 14 : ::ad::physics::Distance valueLongitudinal_stateRss_state_informationSafe_distance(-1e9); 61 : : valueLongitudinal_stateRss_state_information.safe_distance 62 : 14 : = valueLongitudinal_stateRss_state_informationSafe_distance; 63 : 14 : ::ad::physics::Distance valueLongitudinal_stateRss_state_informationCurrent_distance(-1e9); 64 : : valueLongitudinal_stateRss_state_information.current_distance 65 : 14 : = valueLongitudinal_stateRss_state_informationCurrent_distance; 66 : 14 : ::ad::rss::state::RssStateEvaluator valueLongitudinal_stateRss_state_informationEvaluator( 67 : : ::ad::rss::state::RssStateEvaluator::None); 68 : 14 : valueLongitudinal_stateRss_state_information.evaluator = valueLongitudinal_stateRss_state_informationEvaluator; 69 : 14 : valueLongitudinal_state.rss_state_information = valueLongitudinal_stateRss_state_information; 70 : 14 : value.longitudinal_state = valueLongitudinal_state; 71 : 14 : ::ad::rss::state::LateralRssState valueLateral_state_right; 72 : 14 : bool valueLateral_state_rightIs_safe{true}; 73 : 14 : valueLateral_state_right.is_safe = valueLateral_state_rightIs_safe; 74 : 14 : ::ad::rss::state::LateralResponse valueLateral_state_rightResponse(::ad::rss::state::LateralResponse::None); 75 : 14 : valueLateral_state_right.response = valueLateral_state_rightResponse; 76 : 14 : ::ad::rss::world::LateralRssAccelerationValues valueLateral_state_rightAlpha_lat; 77 : 14 : ::ad::physics::Acceleration valueLateral_state_rightAlpha_latAccel_max(-1e2); 78 : 14 : valueLateral_state_rightAlpha_latAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 79 : 14 : valueLateral_state_rightAlpha_lat.accel_max = valueLateral_state_rightAlpha_latAccel_max; 80 : 14 : ::ad::physics::Acceleration valueLateral_state_rightAlpha_latBrake_min(-1e2); 81 : 14 : valueLateral_state_rightAlpha_lat.brake_min = valueLateral_state_rightAlpha_latBrake_min; 82 : 14 : valueLateral_state_right.alpha_lat = valueLateral_state_rightAlpha_lat; 83 : 14 : ::ad::rss::state::RssStateInformation valueLateral_state_rightRss_state_information; 84 : 14 : ::ad::physics::Distance valueLateral_state_rightRss_state_informationSafe_distance(-1e9); 85 : : valueLateral_state_rightRss_state_information.safe_distance 86 : 14 : = valueLateral_state_rightRss_state_informationSafe_distance; 87 : 14 : ::ad::physics::Distance valueLateral_state_rightRss_state_informationCurrent_distance(-1e9); 88 : : valueLateral_state_rightRss_state_information.current_distance 89 : 14 : = valueLateral_state_rightRss_state_informationCurrent_distance; 90 : 14 : ::ad::rss::state::RssStateEvaluator valueLateral_state_rightRss_state_informationEvaluator( 91 : : ::ad::rss::state::RssStateEvaluator::None); 92 : 14 : valueLateral_state_rightRss_state_information.evaluator = valueLateral_state_rightRss_state_informationEvaluator; 93 : 14 : valueLateral_state_right.rss_state_information = valueLateral_state_rightRss_state_information; 94 : 14 : value.lateral_state_right = valueLateral_state_right; 95 : 14 : ::ad::rss::state::LateralRssState valueLateral_state_left; 96 : 14 : bool valueLateral_state_leftIs_safe{true}; 97 : 14 : valueLateral_state_left.is_safe = valueLateral_state_leftIs_safe; 98 : 14 : ::ad::rss::state::LateralResponse valueLateral_state_leftResponse(::ad::rss::state::LateralResponse::None); 99 : 14 : valueLateral_state_left.response = valueLateral_state_leftResponse; 100 : 14 : ::ad::rss::world::LateralRssAccelerationValues valueLateral_state_leftAlpha_lat; 101 : 14 : ::ad::physics::Acceleration valueLateral_state_leftAlpha_latAccel_max(-1e2); 102 : 14 : valueLateral_state_leftAlpha_latAccel_max = ::ad::physics::Acceleration(0.); // set to valid value within struct 103 : 14 : valueLateral_state_leftAlpha_lat.accel_max = valueLateral_state_leftAlpha_latAccel_max; 104 : 14 : ::ad::physics::Acceleration valueLateral_state_leftAlpha_latBrake_min(-1e2); 105 : 14 : valueLateral_state_leftAlpha_lat.brake_min = valueLateral_state_leftAlpha_latBrake_min; 106 : 14 : valueLateral_state_left.alpha_lat = valueLateral_state_leftAlpha_lat; 107 : 14 : ::ad::rss::state::RssStateInformation valueLateral_state_leftRss_state_information; 108 : 14 : ::ad::physics::Distance valueLateral_state_leftRss_state_informationSafe_distance(-1e9); 109 : : valueLateral_state_leftRss_state_information.safe_distance 110 : 14 : = valueLateral_state_leftRss_state_informationSafe_distance; 111 : 14 : ::ad::physics::Distance valueLateral_state_leftRss_state_informationCurrent_distance(-1e9); 112 : : valueLateral_state_leftRss_state_information.current_distance 113 : 14 : = valueLateral_state_leftRss_state_informationCurrent_distance; 114 : 14 : ::ad::rss::state::RssStateEvaluator valueLateral_state_leftRss_state_informationEvaluator( 115 : : ::ad::rss::state::RssStateEvaluator::None); 116 : 14 : valueLateral_state_leftRss_state_information.evaluator = valueLateral_state_leftRss_state_informationEvaluator; 117 : 14 : valueLateral_state_left.rss_state_information = valueLateral_state_leftRss_state_information; 118 : 14 : value.lateral_state_left = valueLateral_state_left; 119 : 14 : ::ad::rss::state::UnstructuredConstellationRssState valueUnstructured_constellation_state; 120 : 14 : bool valueUnstructured_constellation_stateIs_safe{true}; 121 : 14 : valueUnstructured_constellation_state.is_safe = valueUnstructured_constellation_stateIs_safe; 122 : 14 : ::ad::rss::state::UnstructuredConstellationResponse valueUnstructured_constellation_stateResponse( 123 : : ::ad::rss::state::UnstructuredConstellationResponse::None); 124 : 14 : valueUnstructured_constellation_state.response = valueUnstructured_constellation_stateResponse; 125 : 14 : ::ad::geometry::HeadingRange valueUnstructured_constellation_stateHeading_range; 126 : 14 : ::ad::physics::Angle valueUnstructured_constellation_stateHeading_rangeBegin(-6.283185308); 127 : 14 : valueUnstructured_constellation_stateHeading_range.begin = valueUnstructured_constellation_stateHeading_rangeBegin; 128 : 14 : ::ad::physics::Angle valueUnstructured_constellation_stateHeading_rangeEnd(-6.283185308); 129 : 14 : valueUnstructured_constellation_stateHeading_range.end = valueUnstructured_constellation_stateHeading_rangeEnd; 130 : 14 : valueUnstructured_constellation_state.heading_range = valueUnstructured_constellation_stateHeading_range; 131 : : ::ad::rss::state::UnstructuredConstellationStateInformation 132 : 14 : valueUnstructured_constellation_stateRss_state_information; 133 : 14 : ::ad::physics::Distance2DList valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_set; 134 : 14 : ::ad::physics::Distance2D valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElement; 135 : : ::ad::physics::Distance valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElementX( 136 : 14 : -1e9); 137 : : valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElement.x 138 : 14 : = valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElementX; 139 : : ::ad::physics::Distance valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElementY( 140 : 14 : -1e9); 141 : : valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElement.y 142 : 14 : = valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElementY; 143 [ + - ]: 14 : valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_set.resize( 144 : : 1, valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_setElement); 145 : : valueUnstructured_constellation_stateRss_state_information.brake_trajectory_set 146 [ + - ]: 14 : = valueUnstructured_constellation_stateRss_state_informationBrake_trajectory_set; 147 : : ::ad::physics::Distance2DList 148 : 14 : valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_set; 149 : : ::ad::physics::Distance2D 150 : 14 : valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement; 151 : : ::ad::physics::Distance 152 : 14 : valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementX(-1e9); 153 : : valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement.x 154 : 14 : = valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementX; 155 : : ::ad::physics::Distance 156 : 14 : valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementY(-1e9); 157 : : valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement.y 158 : 14 : = valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementY; 159 [ + - ]: 14 : valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_set.resize( 160 : : 1, valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement); 161 : : valueUnstructured_constellation_stateRss_state_information.continue_forward_trajectory_set 162 [ + - ]: 14 : = valueUnstructured_constellation_stateRss_state_informationContinue_forward_trajectory_set; 163 : : ::ad::physics::Angle valueUnstructured_constellation_stateRss_state_informationConsidered_drive_away_steering_angle( 164 : 14 : -6.283185308); 165 : : valueUnstructured_constellation_stateRss_state_information.considered_drive_away_steering_angle 166 : 14 : = valueUnstructured_constellation_stateRss_state_informationConsidered_drive_away_steering_angle; 167 : : valueUnstructured_constellation_state.rss_state_information 168 [ + - ]: 14 : = valueUnstructured_constellation_stateRss_state_information; 169 : 14 : ::ad::rss::world::LongitudinalRssAccelerationValues valueUnstructured_constellation_stateAlpha_lon; 170 : 14 : ::ad::physics::Acceleration valueUnstructured_constellation_stateAlpha_lonAccel_max(-1e2); 171 : : valueUnstructured_constellation_stateAlpha_lonAccel_max 172 : 14 : = ::ad::physics::Acceleration(0.); // set to valid value within struct 173 : 14 : valueUnstructured_constellation_stateAlpha_lon.accel_max = valueUnstructured_constellation_stateAlpha_lonAccel_max; 174 : 14 : ::ad::physics::Acceleration valueUnstructured_constellation_stateAlpha_lonBrake_max(-1e2); 175 : 14 : valueUnstructured_constellation_stateAlpha_lon.brake_max = valueUnstructured_constellation_stateAlpha_lonBrake_max; 176 : 14 : ::ad::physics::Acceleration valueUnstructured_constellation_stateAlpha_lonBrake_min(-1e2); 177 : 14 : valueUnstructured_constellation_stateAlpha_lon.brake_min = valueUnstructured_constellation_stateAlpha_lonBrake_min; 178 : 14 : ::ad::physics::Acceleration valueUnstructured_constellation_stateAlpha_lonBrake_min_correct(-1e2); 179 : : valueUnstructured_constellation_stateAlpha_lon.brake_min_correct 180 : 14 : = valueUnstructured_constellation_stateAlpha_lonBrake_min_correct; 181 : 14 : valueUnstructured_constellation_stateAlpha_lon.brake_min = valueUnstructured_constellation_stateAlpha_lon.brake_max; 182 : : valueUnstructured_constellation_stateAlpha_lon.brake_min_correct 183 : 14 : = valueUnstructured_constellation_stateAlpha_lon.brake_min; 184 : : valueUnstructured_constellation_stateAlpha_lon.brake_min 185 : 14 : = valueUnstructured_constellation_stateAlpha_lon.brake_min_correct; 186 : 14 : valueUnstructured_constellation_stateAlpha_lon.brake_max = valueUnstructured_constellation_stateAlpha_lon.brake_min; 187 : 14 : valueUnstructured_constellation_state.alpha_lon = valueUnstructured_constellation_stateAlpha_lon; 188 [ + - ]: 14 : value.unstructured_constellation_state = valueUnstructured_constellation_state; 189 : 14 : ::ad::rss::world::ConstellationType valueConstellation_type(::ad::rss::world::ConstellationType::NotRelevant); 190 : 14 : value.constellation_type = valueConstellation_type; 191 [ + - ]: 14 : mValue = value; 192 : 14 : } 193 : : 194 : : ::ad::rss::state::RssState mValue; 195 : : }; 196 : : 197 : 4 : TEST_F(RssStateTests, copyConstruction) 198 : : { 199 [ + - ]: 1 : ::ad::rss::state::RssState value(mValue); 200 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 201 : 1 : } 202 : : 203 : 4 : TEST_F(RssStateTests, moveConstruction) 204 : : { 205 [ + - ]: 1 : ::ad::rss::state::RssState tmpValue(mValue); 206 : 1 : ::ad::rss::state::RssState value(std::move(tmpValue)); 207 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 208 : 1 : } 209 : : 210 : 4 : TEST_F(RssStateTests, copyAssignment) 211 : : { 212 : 1 : ::ad::rss::state::RssState value; 213 [ + - ]: 1 : value = mValue; 214 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 215 : 1 : } 216 : : 217 : 4 : TEST_F(RssStateTests, moveAssignment) 218 : : { 219 [ + - ]: 1 : ::ad::rss::state::RssState tmpValue(mValue); 220 : 1 : ::ad::rss::state::RssState value; 221 : 1 : value = std::move(tmpValue); 222 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 223 : 1 : } 224 : : 225 : 4 : TEST_F(RssStateTests, comparisonOperatorEqual) 226 : : { 227 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 228 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 229 : : 230 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 231 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 232 : 1 : } 233 : : 234 : 4 : TEST_F(RssStateTests, stringConversionTest) 235 : : { 236 [ + - ]: 1 : std::stringstream stream; 237 [ + - ]: 1 : stream << mValue; 238 [ + - ]: 1 : std::string ostreamStr = stream.str(); 239 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 240 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - + - ] 241 [ + - + - : 1 : } + - ] 242 : : 243 : 4 : TEST_F(RssStateTests, comparisonOperatorEgo_idDiffers) 244 : : { 245 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 246 : 1 : ::ad::rss::world::ObjectId ego_id(std::numeric_limits<::ad::rss::world::ObjectId>::max()); 247 : 1 : valueA.ego_id = ego_id; 248 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 249 : : 250 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 251 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 252 : 1 : } 253 : : 254 : 4 : TEST_F(RssStateTests, comparisonOperatorObject_idDiffers) 255 : : { 256 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 257 : 1 : ::ad::rss::world::ObjectId object_id(std::numeric_limits<::ad::rss::world::ObjectId>::max()); 258 : 1 : valueA.object_id = object_id; 259 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 260 : : 261 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 262 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 263 : 1 : } 264 : : 265 : 4 : TEST_F(RssStateTests, comparisonOperatorConstellation_idDiffers) 266 : : { 267 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 268 : 1 : ::ad::rss::core::RelativeConstellationId constellation_id( 269 : : std::numeric_limits<::ad::rss::core::RelativeConstellationId>::max()); 270 : 1 : valueA.constellation_id = constellation_id; 271 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 272 : : 273 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 274 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 275 : 1 : } 276 : : 277 : 4 : TEST_F(RssStateTests, comparisonOperatorLongitudinal_stateDiffers) 278 : : { 279 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 280 : 1 : ::ad::rss::state::LongitudinalRssState longitudinal_state; 281 : 1 : bool longitudinal_stateIs_safe{false}; 282 : 1 : longitudinal_state.is_safe = longitudinal_stateIs_safe; 283 : 1 : ::ad::rss::state::LongitudinalResponse longitudinal_stateResponse(::ad::rss::state::LongitudinalResponse::BrakeMin); 284 : 1 : longitudinal_state.response = longitudinal_stateResponse; 285 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues longitudinal_stateAlpha_lon; 286 : 1 : ::ad::physics::Acceleration longitudinal_stateAlpha_lonAccel_max(1e2); 287 : 1 : longitudinal_stateAlpha_lon.accel_max = longitudinal_stateAlpha_lonAccel_max; 288 : 1 : ::ad::physics::Acceleration longitudinal_stateAlpha_lonBrake_max(1e2); 289 : 1 : longitudinal_stateAlpha_lon.brake_max = longitudinal_stateAlpha_lonBrake_max; 290 : 1 : ::ad::physics::Acceleration longitudinal_stateAlpha_lonBrake_min(1e2); 291 : 1 : longitudinal_stateAlpha_lon.brake_min = longitudinal_stateAlpha_lonBrake_min; 292 : 1 : ::ad::physics::Acceleration longitudinal_stateAlpha_lonBrake_min_correct(1e2); 293 : : longitudinal_stateAlpha_lonBrake_min_correct 294 : 1 : = ::ad::physics::Acceleration(0. * 0.9); // set to valid value within struct 295 : 1 : longitudinal_stateAlpha_lon.brake_min_correct = longitudinal_stateAlpha_lonBrake_min_correct; 296 : 1 : longitudinal_stateAlpha_lon.brake_min_correct = longitudinal_stateAlpha_lon.brake_min; 297 : 1 : longitudinal_stateAlpha_lon.brake_min = longitudinal_stateAlpha_lon.brake_max; 298 : 1 : longitudinal_stateAlpha_lon.brake_max = longitudinal_stateAlpha_lon.brake_min; 299 : 1 : longitudinal_stateAlpha_lon.brake_min = longitudinal_stateAlpha_lon.brake_min_correct; 300 : 1 : longitudinal_state.alpha_lon = longitudinal_stateAlpha_lon; 301 : 1 : ::ad::rss::state::RssStateInformation longitudinal_stateRss_state_information; 302 : 1 : ::ad::physics::Distance longitudinal_stateRss_state_informationSafe_distance(1e9); 303 : 1 : longitudinal_stateRss_state_information.safe_distance = longitudinal_stateRss_state_informationSafe_distance; 304 : 1 : ::ad::physics::Distance longitudinal_stateRss_state_informationCurrent_distance(1e9); 305 : 1 : longitudinal_stateRss_state_information.current_distance = longitudinal_stateRss_state_informationCurrent_distance; 306 : 1 : ::ad::rss::state::RssStateEvaluator longitudinal_stateRss_state_informationEvaluator( 307 : : ::ad::rss::state::RssStateEvaluator::IntersectionOverlap); 308 : 1 : longitudinal_stateRss_state_information.evaluator = longitudinal_stateRss_state_informationEvaluator; 309 : 1 : longitudinal_state.rss_state_information = longitudinal_stateRss_state_information; 310 : 1 : valueA.longitudinal_state = longitudinal_state; 311 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 312 : : 313 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 314 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 315 : 1 : } 316 : : 317 : 4 : TEST_F(RssStateTests, comparisonOperatorLateral_state_rightDiffers) 318 : : { 319 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 320 : 1 : ::ad::rss::state::LateralRssState lateral_state_right; 321 : 1 : bool lateral_state_rightIs_safe{false}; 322 : 1 : lateral_state_right.is_safe = lateral_state_rightIs_safe; 323 : 1 : ::ad::rss::state::LateralResponse lateral_state_rightResponse(::ad::rss::state::LateralResponse::BrakeMin); 324 : 1 : lateral_state_right.response = lateral_state_rightResponse; 325 : 1 : ::ad::rss::world::LateralRssAccelerationValues lateral_state_rightAlpha_lat; 326 : 1 : ::ad::physics::Acceleration lateral_state_rightAlpha_latAccel_max(1e2); 327 : 1 : lateral_state_rightAlpha_lat.accel_max = lateral_state_rightAlpha_latAccel_max; 328 : 1 : ::ad::physics::Acceleration lateral_state_rightAlpha_latBrake_min(1e2); 329 : 1 : lateral_state_rightAlpha_latBrake_min = ::ad::physics::Acceleration(0. * 0.9); // set to valid value within struct 330 : 1 : lateral_state_rightAlpha_lat.brake_min = lateral_state_rightAlpha_latBrake_min; 331 : 1 : lateral_state_right.alpha_lat = lateral_state_rightAlpha_lat; 332 : 1 : ::ad::rss::state::RssStateInformation lateral_state_rightRss_state_information; 333 : 1 : ::ad::physics::Distance lateral_state_rightRss_state_informationSafe_distance(1e9); 334 : 1 : lateral_state_rightRss_state_information.safe_distance = lateral_state_rightRss_state_informationSafe_distance; 335 : 1 : ::ad::physics::Distance lateral_state_rightRss_state_informationCurrent_distance(1e9); 336 : 1 : lateral_state_rightRss_state_information.current_distance = lateral_state_rightRss_state_informationCurrent_distance; 337 : 1 : ::ad::rss::state::RssStateEvaluator lateral_state_rightRss_state_informationEvaluator( 338 : : ::ad::rss::state::RssStateEvaluator::IntersectionOverlap); 339 : 1 : lateral_state_rightRss_state_information.evaluator = lateral_state_rightRss_state_informationEvaluator; 340 : 1 : lateral_state_right.rss_state_information = lateral_state_rightRss_state_information; 341 : 1 : valueA.lateral_state_right = lateral_state_right; 342 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 343 : : 344 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 345 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 346 : 1 : } 347 : : 348 : 4 : TEST_F(RssStateTests, comparisonOperatorLateral_state_leftDiffers) 349 : : { 350 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 351 : 1 : ::ad::rss::state::LateralRssState lateral_state_left; 352 : 1 : bool lateral_state_leftIs_safe{false}; 353 : 1 : lateral_state_left.is_safe = lateral_state_leftIs_safe; 354 : 1 : ::ad::rss::state::LateralResponse lateral_state_leftResponse(::ad::rss::state::LateralResponse::BrakeMin); 355 : 1 : lateral_state_left.response = lateral_state_leftResponse; 356 : 1 : ::ad::rss::world::LateralRssAccelerationValues lateral_state_leftAlpha_lat; 357 : 1 : ::ad::physics::Acceleration lateral_state_leftAlpha_latAccel_max(1e2); 358 : 1 : lateral_state_leftAlpha_lat.accel_max = lateral_state_leftAlpha_latAccel_max; 359 : 1 : ::ad::physics::Acceleration lateral_state_leftAlpha_latBrake_min(1e2); 360 : 1 : lateral_state_leftAlpha_latBrake_min = ::ad::physics::Acceleration(0. * 0.9); // set to valid value within struct 361 : 1 : lateral_state_leftAlpha_lat.brake_min = lateral_state_leftAlpha_latBrake_min; 362 : 1 : lateral_state_left.alpha_lat = lateral_state_leftAlpha_lat; 363 : 1 : ::ad::rss::state::RssStateInformation lateral_state_leftRss_state_information; 364 : 1 : ::ad::physics::Distance lateral_state_leftRss_state_informationSafe_distance(1e9); 365 : 1 : lateral_state_leftRss_state_information.safe_distance = lateral_state_leftRss_state_informationSafe_distance; 366 : 1 : ::ad::physics::Distance lateral_state_leftRss_state_informationCurrent_distance(1e9); 367 : 1 : lateral_state_leftRss_state_information.current_distance = lateral_state_leftRss_state_informationCurrent_distance; 368 : 1 : ::ad::rss::state::RssStateEvaluator lateral_state_leftRss_state_informationEvaluator( 369 : : ::ad::rss::state::RssStateEvaluator::IntersectionOverlap); 370 : 1 : lateral_state_leftRss_state_information.evaluator = lateral_state_leftRss_state_informationEvaluator; 371 : 1 : lateral_state_left.rss_state_information = lateral_state_leftRss_state_information; 372 : 1 : valueA.lateral_state_left = lateral_state_left; 373 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 374 : : 375 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 376 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 377 : 1 : } 378 : : 379 : 4 : TEST_F(RssStateTests, comparisonOperatorUnstructured_constellation_stateDiffers) 380 : : { 381 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 382 : 1 : ::ad::rss::state::UnstructuredConstellationRssState unstructured_constellation_state; 383 : 1 : bool unstructured_constellation_stateIs_safe{false}; 384 : 1 : unstructured_constellation_state.is_safe = unstructured_constellation_stateIs_safe; 385 : 1 : ::ad::rss::state::UnstructuredConstellationResponse unstructured_constellation_stateResponse( 386 : : ::ad::rss::state::UnstructuredConstellationResponse::Brake); 387 : 1 : unstructured_constellation_state.response = unstructured_constellation_stateResponse; 388 : 1 : ::ad::geometry::HeadingRange unstructured_constellation_stateHeading_range; 389 : 1 : ::ad::physics::Angle unstructured_constellation_stateHeading_rangeBegin(6.283185308); 390 : 1 : unstructured_constellation_stateHeading_range.begin = unstructured_constellation_stateHeading_rangeBegin; 391 : 1 : ::ad::physics::Angle unstructured_constellation_stateHeading_rangeEnd(6.283185308); 392 : 1 : unstructured_constellation_stateHeading_range.end = unstructured_constellation_stateHeading_rangeEnd; 393 : 1 : unstructured_constellation_state.heading_range = unstructured_constellation_stateHeading_range; 394 : 1 : ::ad::rss::state::UnstructuredConstellationStateInformation unstructured_constellation_stateRss_state_information; 395 : 1 : ::ad::physics::Distance2DList unstructured_constellation_stateRss_state_informationBrake_trajectory_set; 396 : 1 : ::ad::physics::Distance2D unstructured_constellation_stateRss_state_informationBrake_trajectory_setElement; 397 : 1 : ::ad::physics::Distance unstructured_constellation_stateRss_state_informationBrake_trajectory_setElementX(1e9); 398 : : unstructured_constellation_stateRss_state_informationBrake_trajectory_setElement.x 399 : 1 : = unstructured_constellation_stateRss_state_informationBrake_trajectory_setElementX; 400 : 1 : ::ad::physics::Distance unstructured_constellation_stateRss_state_informationBrake_trajectory_setElementY(1e9); 401 : : unstructured_constellation_stateRss_state_informationBrake_trajectory_setElement.y 402 : 1 : = unstructured_constellation_stateRss_state_informationBrake_trajectory_setElementY; 403 [ + - ]: 1 : unstructured_constellation_stateRss_state_informationBrake_trajectory_set.resize( 404 : : 2, unstructured_constellation_stateRss_state_informationBrake_trajectory_setElement); 405 : : unstructured_constellation_stateRss_state_information.brake_trajectory_set 406 [ + - ]: 1 : = unstructured_constellation_stateRss_state_informationBrake_trajectory_set; 407 : 1 : ::ad::physics::Distance2DList unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_set; 408 : 1 : ::ad::physics::Distance2D unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement; 409 : : ::ad::physics::Distance unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementX( 410 : 1 : 1e9); 411 : : unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement.x 412 : 1 : = unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementX; 413 : : ::ad::physics::Distance unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementY( 414 : 1 : 1e9); 415 : : unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement.y 416 : 1 : = unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElementY; 417 [ + - ]: 1 : unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_set.resize( 418 : : 2, unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_setElement); 419 : : unstructured_constellation_stateRss_state_information.continue_forward_trajectory_set 420 [ + - ]: 1 : = unstructured_constellation_stateRss_state_informationContinue_forward_trajectory_set; 421 : : ::ad::physics::Angle unstructured_constellation_stateRss_state_informationConsidered_drive_away_steering_angle( 422 : 1 : 6.283185308); 423 : : unstructured_constellation_stateRss_state_information.considered_drive_away_steering_angle 424 : 1 : = unstructured_constellation_stateRss_state_informationConsidered_drive_away_steering_angle; 425 [ + - ]: 1 : unstructured_constellation_state.rss_state_information = unstructured_constellation_stateRss_state_information; 426 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues unstructured_constellation_stateAlpha_lon; 427 : 1 : ::ad::physics::Acceleration unstructured_constellation_stateAlpha_lonAccel_max(1e2); 428 : 1 : unstructured_constellation_stateAlpha_lon.accel_max = unstructured_constellation_stateAlpha_lonAccel_max; 429 : 1 : ::ad::physics::Acceleration unstructured_constellation_stateAlpha_lonBrake_max(1e2); 430 : 1 : unstructured_constellation_stateAlpha_lon.brake_max = unstructured_constellation_stateAlpha_lonBrake_max; 431 : 1 : ::ad::physics::Acceleration unstructured_constellation_stateAlpha_lonBrake_min(1e2); 432 : 1 : unstructured_constellation_stateAlpha_lon.brake_min = unstructured_constellation_stateAlpha_lonBrake_min; 433 : 1 : ::ad::physics::Acceleration unstructured_constellation_stateAlpha_lonBrake_min_correct(1e2); 434 : : unstructured_constellation_stateAlpha_lonBrake_min_correct 435 : 1 : = ::ad::physics::Acceleration(0. * 0.9); // set to valid value within struct 436 : : unstructured_constellation_stateAlpha_lon.brake_min_correct 437 : 1 : = unstructured_constellation_stateAlpha_lonBrake_min_correct; 438 : 1 : unstructured_constellation_stateAlpha_lon.brake_min_correct = unstructured_constellation_stateAlpha_lon.brake_min; 439 : 1 : unstructured_constellation_stateAlpha_lon.brake_min = unstructured_constellation_stateAlpha_lon.brake_max; 440 : 1 : unstructured_constellation_stateAlpha_lon.brake_max = unstructured_constellation_stateAlpha_lon.brake_min; 441 : 1 : unstructured_constellation_stateAlpha_lon.brake_min = unstructured_constellation_stateAlpha_lon.brake_min_correct; 442 : 1 : unstructured_constellation_state.alpha_lon = unstructured_constellation_stateAlpha_lon; 443 [ + - ]: 1 : valueA.unstructured_constellation_state = unstructured_constellation_state; 444 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 445 : : 446 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 447 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 448 : 1 : } 449 : : 450 : 4 : TEST_F(RssStateTests, comparisonOperatorConstellation_typeDiffers) 451 : : { 452 [ + - ]: 1 : ::ad::rss::state::RssState valueA = mValue; 453 : 1 : ::ad::rss::world::ConstellationType constellation_type(::ad::rss::world::ConstellationType::Unstructured); 454 : 1 : valueA.constellation_type = constellation_type; 455 [ + - ]: 1 : ::ad::rss::state::RssState valueB = mValue; 456 : : 457 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 458 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 459 : 1 : } 460 : : 461 : : #if defined(__clang__) && (__clang_major__ >= 7) 462 : : #pragma GCC diagnostic pop 463 : : #endif