Branch data Line data Source code
1 : : /* 2 : : * ----------------- BEGIN LICENSE BLOCK --------------------------------- 3 : : * 4 : : * Copyright (C) 2018-2021 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 : : #include <gtest/gtest.h> 16 : : 17 : : #include <limits> 18 : : 19 : : #include "ad/rss/situation/VehicleStateValidInputRange.hpp" 20 : : 21 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRange) 22 : : { 23 : 1 : ::ad::rss::situation::VehicleState value; 24 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 25 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 26 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 27 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 28 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 29 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 30 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 31 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 32 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 33 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 34 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 35 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 36 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 37 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 38 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 39 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 40 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 41 : 1 : value.velocity = valueVelocity; 42 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 43 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 44 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 45 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 46 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 47 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 48 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 49 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 50 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 51 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 52 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 53 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 54 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 55 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 56 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 57 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 58 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 59 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 60 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 61 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 62 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 63 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 64 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 65 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 66 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 67 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 68 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 69 : : valueDynamicsResponseTime 70 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 71 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 72 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 73 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 74 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 75 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 76 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 77 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 78 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 79 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 80 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 81 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 82 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 83 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 84 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 85 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 86 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 87 : : std::numeric_limits<uint32_t>::min()}; 88 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 89 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 90 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 91 : : std::numeric_limits<uint32_t>::min()}; 92 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 93 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 94 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 95 : : std::numeric_limits<uint32_t>::min()}; 96 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 97 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 98 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 99 : : std::numeric_limits<uint32_t>::min()}; 100 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 101 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 102 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 103 : 1 : value.dynamics = valueDynamics; 104 : 1 : bool valueHasPriority{true}; 105 : 1 : value.hasPriority = valueHasPriority; 106 : 1 : bool valueIsInCorrectLane{true}; 107 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 108 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 109 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 110 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 111 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 112 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 113 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 114 : 1 : value.objectType = valueObjectType; 115 : 1 : ::ad::rss::world::ObjectState valueObjectState; 116 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 117 : 1 : valueObjectState.yaw = valueObjectStateYaw; 118 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 119 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 120 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 121 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 122 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 123 : 1 : valueObjectState.dimension = valueObjectStateDimension; 124 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 125 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 126 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 127 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 128 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 129 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 130 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 131 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 132 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 133 : 1 : valueObjectState.speed = valueObjectStateSpeed; 134 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 135 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 136 : 1 : value.objectState = valueObjectState; 137 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 138 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 139 [ + - - + : 1 : ASSERT_TRUE(withinValidInputRange(value)); - - - - - - - - ] 140 : : } 141 : : 142 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeVelocityTooSmall) 143 : : { 144 : 1 : ::ad::rss::situation::VehicleState value; 145 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 146 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 147 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 148 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 149 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 150 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 151 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 152 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 153 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 154 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 155 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 156 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 157 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 158 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 159 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 160 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 161 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 162 : 1 : value.velocity = valueVelocity; 163 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 164 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 165 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 166 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 167 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 168 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 169 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 170 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 171 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 172 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 173 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 174 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 175 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 176 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 177 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 178 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 179 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 180 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 181 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 182 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 183 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 184 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 185 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 186 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 187 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 188 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 189 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 190 : : valueDynamicsResponseTime 191 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 192 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 193 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 194 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 195 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 196 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 197 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 198 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 199 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 200 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 201 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 202 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 203 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 204 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 205 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 206 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 207 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 208 : : std::numeric_limits<uint32_t>::min()}; 209 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 210 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 211 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 212 : : std::numeric_limits<uint32_t>::min()}; 213 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 214 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 215 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 216 : : std::numeric_limits<uint32_t>::min()}; 217 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 218 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 219 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 220 : : std::numeric_limits<uint32_t>::min()}; 221 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 222 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 223 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 224 : 1 : value.dynamics = valueDynamics; 225 : 1 : bool valueHasPriority{true}; 226 : 1 : value.hasPriority = valueHasPriority; 227 : 1 : bool valueIsInCorrectLane{true}; 228 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 229 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 230 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 231 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 232 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 233 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 234 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 235 : 1 : value.objectType = valueObjectType; 236 : 1 : ::ad::rss::world::ObjectState valueObjectState; 237 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 238 : 1 : valueObjectState.yaw = valueObjectStateYaw; 239 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 240 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 241 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 242 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 243 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 244 : 1 : valueObjectState.dimension = valueObjectStateDimension; 245 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 246 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 247 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 248 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 249 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 250 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 251 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 252 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 253 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 254 : 1 : valueObjectState.speed = valueObjectStateSpeed; 255 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 256 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 257 : 1 : value.objectState = valueObjectState; 258 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 259 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 260 : : 261 : : // override member with data type value below input range minimum 262 : 1 : ::ad::rss::situation::VelocityRange invalidInitializedMember; 263 : 1 : ::ad::physics::SpeedRange invalidInitializedMemberSpeedLon; 264 : 1 : ::ad::physics::Speed invalidInitializedMemberSpeedLonMinimum(-100. * 1.1); 265 : 1 : invalidInitializedMemberSpeedLon.minimum = invalidInitializedMemberSpeedLonMinimum; 266 : 1 : invalidInitializedMember.speedLon = invalidInitializedMemberSpeedLon; 267 : 1 : value.velocity = invalidInitializedMember; 268 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 269 : : } 270 : : 271 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeVelocityTooBig) 272 : : { 273 : 1 : ::ad::rss::situation::VehicleState value; 274 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 275 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 276 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 277 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 278 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 279 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 280 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 281 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 282 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 283 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 284 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 285 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 286 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 287 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 288 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 289 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 290 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 291 : 1 : value.velocity = valueVelocity; 292 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 293 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 294 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 295 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 296 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 297 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 298 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 299 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 300 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 301 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 302 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 303 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 304 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 305 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 306 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 307 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 308 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 309 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 310 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 311 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 312 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 313 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 314 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 315 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 316 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 317 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 318 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 319 : : valueDynamicsResponseTime 320 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 321 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 322 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 323 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 324 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 325 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 326 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 327 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 328 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 329 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 330 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 331 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 332 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 333 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 334 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 335 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 336 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 337 : : std::numeric_limits<uint32_t>::min()}; 338 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 339 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 340 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 341 : : std::numeric_limits<uint32_t>::min()}; 342 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 343 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 344 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 345 : : std::numeric_limits<uint32_t>::min()}; 346 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 347 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 348 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 349 : : std::numeric_limits<uint32_t>::min()}; 350 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 351 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 352 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 353 : 1 : value.dynamics = valueDynamics; 354 : 1 : bool valueHasPriority{true}; 355 : 1 : value.hasPriority = valueHasPriority; 356 : 1 : bool valueIsInCorrectLane{true}; 357 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 358 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 359 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 360 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 361 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 362 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 363 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 364 : 1 : value.objectType = valueObjectType; 365 : 1 : ::ad::rss::world::ObjectState valueObjectState; 366 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 367 : 1 : valueObjectState.yaw = valueObjectStateYaw; 368 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 369 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 370 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 371 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 372 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 373 : 1 : valueObjectState.dimension = valueObjectStateDimension; 374 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 375 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 376 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 377 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 378 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 379 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 380 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 381 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 382 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 383 : 1 : valueObjectState.speed = valueObjectStateSpeed; 384 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 385 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 386 : 1 : value.objectState = valueObjectState; 387 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 388 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 389 : : 390 : : // override member with data type value above input range maximum 391 : 1 : ::ad::rss::situation::VelocityRange invalidInitializedMember; 392 : 1 : ::ad::physics::SpeedRange invalidInitializedMemberSpeedLon; 393 : 1 : ::ad::physics::Speed invalidInitializedMemberSpeedLonMinimum(100. * 1.1); 394 : 1 : invalidInitializedMemberSpeedLon.minimum = invalidInitializedMemberSpeedLonMinimum; 395 : 1 : invalidInitializedMember.speedLon = invalidInitializedMemberSpeedLon; 396 : 1 : value.velocity = invalidInitializedMember; 397 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 398 : : } 399 : : 400 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeDynamicsTooSmall) 401 : : { 402 : 1 : ::ad::rss::situation::VehicleState value; 403 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 404 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 405 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 406 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 407 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 408 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 409 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 410 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 411 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 412 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 413 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 414 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 415 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 416 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 417 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 418 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 419 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 420 : 1 : value.velocity = valueVelocity; 421 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 422 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 423 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 424 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 425 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 426 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 427 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 428 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 429 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 430 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 431 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 432 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 433 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 434 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 435 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 436 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 437 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 438 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 439 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 440 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 441 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 442 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 443 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 444 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 445 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 446 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 447 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 448 : : valueDynamicsResponseTime 449 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 450 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 451 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 452 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 453 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 454 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 455 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 456 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 457 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 458 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 459 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 460 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 461 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 462 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 463 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 464 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 465 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 466 : : std::numeric_limits<uint32_t>::min()}; 467 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 468 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 469 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 470 : : std::numeric_limits<uint32_t>::min()}; 471 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 472 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 473 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 474 : : std::numeric_limits<uint32_t>::min()}; 475 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 476 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 477 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 478 : : std::numeric_limits<uint32_t>::min()}; 479 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 480 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 481 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 482 : 1 : value.dynamics = valueDynamics; 483 : 1 : bool valueHasPriority{true}; 484 : 1 : value.hasPriority = valueHasPriority; 485 : 1 : bool valueIsInCorrectLane{true}; 486 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 487 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 488 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 489 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 490 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 491 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 492 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 493 : 1 : value.objectType = valueObjectType; 494 : 1 : ::ad::rss::world::ObjectState valueObjectState; 495 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 496 : 1 : valueObjectState.yaw = valueObjectStateYaw; 497 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 498 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 499 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 500 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 501 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 502 : 1 : valueObjectState.dimension = valueObjectStateDimension; 503 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 504 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 505 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 506 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 507 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 508 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 509 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 510 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 511 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 512 : 1 : valueObjectState.speed = valueObjectStateSpeed; 513 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 514 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 515 : 1 : value.objectState = valueObjectState; 516 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 517 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 518 : : 519 : : // override member with data type value below input range minimum 520 : 1 : ::ad::rss::world::RssDynamics invalidInitializedMember; 521 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues invalidInitializedMemberAlphaLon; 522 : 1 : ::ad::physics::Acceleration invalidInitializedMemberAlphaLonAccelMax(-1e2 * 1.1); 523 : 1 : invalidInitializedMemberAlphaLon.accelMax = invalidInitializedMemberAlphaLonAccelMax; 524 : 1 : invalidInitializedMember.alphaLon = invalidInitializedMemberAlphaLon; 525 : 1 : value.dynamics = invalidInitializedMember; 526 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 527 : : } 528 : : 529 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeDynamicsTooBig) 530 : : { 531 : 1 : ::ad::rss::situation::VehicleState value; 532 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 533 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 534 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 535 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 536 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 537 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 538 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 539 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 540 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 541 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 542 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 543 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 544 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 545 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 546 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 547 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 548 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 549 : 1 : value.velocity = valueVelocity; 550 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 551 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 552 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 553 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 554 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 555 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 556 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 557 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 558 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 559 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 560 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 561 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 562 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 563 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 564 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 565 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 566 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 567 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 568 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 569 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 570 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 571 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 572 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 573 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 574 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 575 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 576 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 577 : : valueDynamicsResponseTime 578 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 579 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 580 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 581 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 582 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 583 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 584 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 585 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 586 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 587 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 588 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 589 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 590 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 591 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 592 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 593 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 594 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 595 : : std::numeric_limits<uint32_t>::min()}; 596 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 597 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 598 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 599 : : std::numeric_limits<uint32_t>::min()}; 600 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 601 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 602 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 603 : : std::numeric_limits<uint32_t>::min()}; 604 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 605 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 606 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 607 : : std::numeric_limits<uint32_t>::min()}; 608 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 609 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 610 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 611 : 1 : value.dynamics = valueDynamics; 612 : 1 : bool valueHasPriority{true}; 613 : 1 : value.hasPriority = valueHasPriority; 614 : 1 : bool valueIsInCorrectLane{true}; 615 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 616 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 617 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 618 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 619 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 620 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 621 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 622 : 1 : value.objectType = valueObjectType; 623 : 1 : ::ad::rss::world::ObjectState valueObjectState; 624 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 625 : 1 : valueObjectState.yaw = valueObjectStateYaw; 626 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 627 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 628 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 629 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 630 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 631 : 1 : valueObjectState.dimension = valueObjectStateDimension; 632 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 633 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 634 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 635 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 636 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 637 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 638 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 639 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 640 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 641 : 1 : valueObjectState.speed = valueObjectStateSpeed; 642 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 643 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 644 : 1 : value.objectState = valueObjectState; 645 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 646 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 647 : : 648 : : // override member with data type value above input range maximum 649 : 1 : ::ad::rss::world::RssDynamics invalidInitializedMember; 650 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues invalidInitializedMemberAlphaLon; 651 : 1 : ::ad::physics::Acceleration invalidInitializedMemberAlphaLonAccelMax(1e2 * 1.1); 652 : 1 : invalidInitializedMemberAlphaLon.accelMax = invalidInitializedMemberAlphaLonAccelMax; 653 : 1 : invalidInitializedMember.alphaLon = invalidInitializedMemberAlphaLon; 654 : 1 : value.dynamics = invalidInitializedMember; 655 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 656 : : } 657 : : 658 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeDistanceToEnterIntersectionTooSmall) 659 : : { 660 : 1 : ::ad::rss::situation::VehicleState value; 661 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 662 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 663 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 664 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 665 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 666 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 667 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 668 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 669 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 670 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 671 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 672 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 673 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 674 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 675 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 676 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 677 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 678 : 1 : value.velocity = valueVelocity; 679 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 680 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 681 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 682 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 683 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 684 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 685 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 686 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 687 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 688 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 689 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 690 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 691 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 692 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 693 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 694 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 695 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 696 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 697 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 698 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 699 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 700 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 701 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 702 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 703 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 704 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 705 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 706 : : valueDynamicsResponseTime 707 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 708 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 709 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 710 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 711 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 712 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 713 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 714 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 715 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 716 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 717 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 718 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 719 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 720 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 721 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 722 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 723 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 724 : : std::numeric_limits<uint32_t>::min()}; 725 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 726 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 727 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 728 : : std::numeric_limits<uint32_t>::min()}; 729 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 730 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 731 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 732 : : std::numeric_limits<uint32_t>::min()}; 733 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 734 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 735 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 736 : : std::numeric_limits<uint32_t>::min()}; 737 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 738 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 739 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 740 : 1 : value.dynamics = valueDynamics; 741 : 1 : bool valueHasPriority{true}; 742 : 1 : value.hasPriority = valueHasPriority; 743 : 1 : bool valueIsInCorrectLane{true}; 744 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 745 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 746 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 747 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 748 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 749 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 750 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 751 : 1 : value.objectType = valueObjectType; 752 : 1 : ::ad::rss::world::ObjectState valueObjectState; 753 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 754 : 1 : valueObjectState.yaw = valueObjectStateYaw; 755 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 756 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 757 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 758 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 759 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 760 : 1 : valueObjectState.dimension = valueObjectStateDimension; 761 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 762 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 763 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 764 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 765 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 766 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 767 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 768 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 769 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 770 : 1 : valueObjectState.speed = valueObjectStateSpeed; 771 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 772 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 773 : 1 : value.objectState = valueObjectState; 774 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 775 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 776 : : 777 : : // override member with data type value below input range minimum 778 : 1 : ::ad::physics::Distance invalidInitializedMember(-1e9 * 1.1); 779 : 1 : value.distanceToEnterIntersection = invalidInitializedMember; 780 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 781 : : 782 : : // override member with value below struct member input range minimum 783 : : invalidInitializedMember 784 : 1 : = ::ad::physics::Distance(0. - ::ad::physics::Distance::cPrecisionValue); // set to invalid value within struct 785 : 1 : value.distanceToEnterIntersection = invalidInitializedMember; 786 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 787 : : } 788 : : 789 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeDistanceToEnterIntersectionTooBig) 790 : : { 791 : 1 : ::ad::rss::situation::VehicleState value; 792 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 793 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 794 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 795 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 796 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 797 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 798 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 799 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 800 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 801 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 802 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 803 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 804 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 805 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 806 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 807 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 808 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 809 : 1 : value.velocity = valueVelocity; 810 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 811 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 812 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 813 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 814 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 815 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 816 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 817 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 818 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 819 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 820 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 821 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 822 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 823 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 824 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 825 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 826 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 827 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 828 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 829 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 830 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 831 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 832 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 833 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 834 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 835 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 836 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 837 : : valueDynamicsResponseTime 838 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 839 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 840 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 841 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 842 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 843 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 844 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 845 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 846 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 847 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 848 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 849 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 850 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 851 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 852 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 853 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 854 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 855 : : std::numeric_limits<uint32_t>::min()}; 856 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 857 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 858 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 859 : : std::numeric_limits<uint32_t>::min()}; 860 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 861 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 862 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 863 : : std::numeric_limits<uint32_t>::min()}; 864 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 865 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 866 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 867 : : std::numeric_limits<uint32_t>::min()}; 868 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 869 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 870 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 871 : 1 : value.dynamics = valueDynamics; 872 : 1 : bool valueHasPriority{true}; 873 : 1 : value.hasPriority = valueHasPriority; 874 : 1 : bool valueIsInCorrectLane{true}; 875 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 876 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 877 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 878 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 879 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 880 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 881 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 882 : 1 : value.objectType = valueObjectType; 883 : 1 : ::ad::rss::world::ObjectState valueObjectState; 884 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 885 : 1 : valueObjectState.yaw = valueObjectStateYaw; 886 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 887 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 888 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 889 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 890 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 891 : 1 : valueObjectState.dimension = valueObjectStateDimension; 892 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 893 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 894 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 895 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 896 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 897 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 898 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 899 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 900 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 901 : 1 : valueObjectState.speed = valueObjectStateSpeed; 902 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 903 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 904 : 1 : value.objectState = valueObjectState; 905 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 906 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 907 : : 908 : : // override member with data type value above input range maximum 909 : 1 : ::ad::physics::Distance invalidInitializedMember(1e9 * 1.1); 910 : 1 : value.distanceToEnterIntersection = invalidInitializedMember; 911 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 912 : : } 913 : : 914 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangedistanceToEnterIntersectionDefault) 915 : : { 916 : 1 : ::ad::rss::situation::VehicleState value; 917 : 1 : ::ad::physics::Distance valueDefault; 918 : 1 : value.distanceToEnterIntersection = valueDefault; 919 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 920 : : } 921 : : 922 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeDistanceToLeaveIntersectionTooSmall) 923 : : { 924 : 1 : ::ad::rss::situation::VehicleState value; 925 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 926 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 927 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 928 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 929 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 930 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 931 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 932 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 933 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 934 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 935 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 936 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 937 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 938 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 939 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 940 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 941 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 942 : 1 : value.velocity = valueVelocity; 943 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 944 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 945 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 946 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 947 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 948 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 949 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 950 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 951 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 952 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 953 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 954 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 955 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 956 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 957 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 958 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 959 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 960 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 961 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 962 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 963 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 964 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 965 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 966 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 967 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 968 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 969 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 970 : : valueDynamicsResponseTime 971 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 972 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 973 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 974 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 975 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 976 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 977 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 978 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 979 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 980 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 981 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 982 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 983 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 984 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 985 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 986 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 987 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 988 : : std::numeric_limits<uint32_t>::min()}; 989 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 990 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 991 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 992 : : std::numeric_limits<uint32_t>::min()}; 993 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 994 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 995 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 996 : : std::numeric_limits<uint32_t>::min()}; 997 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 998 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 999 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 1000 : : std::numeric_limits<uint32_t>::min()}; 1001 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 1002 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 1003 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 1004 : 1 : value.dynamics = valueDynamics; 1005 : 1 : bool valueHasPriority{true}; 1006 : 1 : value.hasPriority = valueHasPriority; 1007 : 1 : bool valueIsInCorrectLane{true}; 1008 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 1009 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 1010 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 1011 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 1012 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 1013 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 1014 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 1015 : 1 : value.objectType = valueObjectType; 1016 : 1 : ::ad::rss::world::ObjectState valueObjectState; 1017 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 1018 : 1 : valueObjectState.yaw = valueObjectStateYaw; 1019 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 1020 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 1021 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 1022 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 1023 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 1024 : 1 : valueObjectState.dimension = valueObjectStateDimension; 1025 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 1026 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 1027 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 1028 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 1029 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 1030 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 1031 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 1032 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 1033 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 1034 : 1 : valueObjectState.speed = valueObjectStateSpeed; 1035 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 1036 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 1037 : 1 : value.objectState = valueObjectState; 1038 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 1039 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 1040 : : 1041 : : // override member with data type value below input range minimum 1042 : 1 : ::ad::physics::Distance invalidInitializedMember(-1e9 * 1.1); 1043 : 1 : value.distanceToLeaveIntersection = invalidInitializedMember; 1044 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1045 : : } 1046 : : 1047 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeDistanceToLeaveIntersectionTooBig) 1048 : : { 1049 : 1 : ::ad::rss::situation::VehicleState value; 1050 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 1051 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 1052 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 1053 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 1054 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 1055 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 1056 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 1057 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 1058 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 1059 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 1060 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 1061 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 1062 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 1063 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 1064 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 1065 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 1066 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 1067 : 1 : value.velocity = valueVelocity; 1068 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 1069 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 1070 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 1071 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1072 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 1073 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 1074 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 1075 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 1076 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 1077 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 1078 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 1079 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 1080 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 1081 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 1082 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 1083 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 1084 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 1085 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 1086 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1087 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 1088 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 1089 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 1090 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 1091 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 1092 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 1093 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 1094 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 1095 : : valueDynamicsResponseTime 1096 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 1097 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 1098 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 1099 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 1100 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 1101 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 1102 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 1103 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 1104 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 1105 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 1106 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 1107 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 1108 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 1109 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 1110 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 1111 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 1112 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 1113 : : std::numeric_limits<uint32_t>::min()}; 1114 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 1115 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 1116 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 1117 : : std::numeric_limits<uint32_t>::min()}; 1118 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 1119 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 1120 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 1121 : : std::numeric_limits<uint32_t>::min()}; 1122 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 1123 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 1124 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 1125 : : std::numeric_limits<uint32_t>::min()}; 1126 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 1127 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 1128 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 1129 : 1 : value.dynamics = valueDynamics; 1130 : 1 : bool valueHasPriority{true}; 1131 : 1 : value.hasPriority = valueHasPriority; 1132 : 1 : bool valueIsInCorrectLane{true}; 1133 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 1134 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 1135 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 1136 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 1137 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 1138 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 1139 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 1140 : 1 : value.objectType = valueObjectType; 1141 : 1 : ::ad::rss::world::ObjectState valueObjectState; 1142 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 1143 : 1 : valueObjectState.yaw = valueObjectStateYaw; 1144 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 1145 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 1146 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 1147 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 1148 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 1149 : 1 : valueObjectState.dimension = valueObjectStateDimension; 1150 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 1151 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 1152 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 1153 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 1154 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 1155 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 1156 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 1157 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 1158 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 1159 : 1 : valueObjectState.speed = valueObjectStateSpeed; 1160 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 1161 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 1162 : 1 : value.objectState = valueObjectState; 1163 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 1164 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 1165 : : 1166 : : // override member with data type value above input range maximum 1167 : 1 : ::ad::physics::Distance invalidInitializedMember(1e9 * 1.1); 1168 : 1 : value.distanceToLeaveIntersection = invalidInitializedMember; 1169 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1170 : : 1171 : : // override member with value above struct member input range maximum 1172 : 1 : invalidInitializedMember = ::ad::physics::Distance(1e4 * 1.1); // set to invalid value within struct 1173 : 1 : value.distanceToLeaveIntersection = invalidInitializedMember; 1174 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1175 : : } 1176 : : 1177 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangedistanceToLeaveIntersectionDefault) 1178 : : { 1179 : 1 : ::ad::rss::situation::VehicleState value; 1180 : 1 : ::ad::physics::Distance valueDefault; 1181 : 1 : value.distanceToLeaveIntersection = valueDefault; 1182 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1183 : : } 1184 : : 1185 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeObjectTypeTooSmall) 1186 : : { 1187 : 1 : ::ad::rss::situation::VehicleState value; 1188 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 1189 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 1190 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 1191 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 1192 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 1193 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 1194 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 1195 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 1196 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 1197 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 1198 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 1199 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 1200 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 1201 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 1202 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 1203 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 1204 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 1205 : 1 : value.velocity = valueVelocity; 1206 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 1207 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 1208 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 1209 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1210 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 1211 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 1212 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 1213 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 1214 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 1215 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 1216 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 1217 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 1218 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 1219 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 1220 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 1221 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 1222 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 1223 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 1224 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1225 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 1226 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 1227 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 1228 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 1229 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 1230 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 1231 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 1232 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 1233 : : valueDynamicsResponseTime 1234 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 1235 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 1236 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 1237 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 1238 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 1239 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 1240 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 1241 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 1242 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 1243 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 1244 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 1245 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 1246 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 1247 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 1248 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 1249 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 1250 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 1251 : : std::numeric_limits<uint32_t>::min()}; 1252 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 1253 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 1254 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 1255 : : std::numeric_limits<uint32_t>::min()}; 1256 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 1257 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 1258 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 1259 : : std::numeric_limits<uint32_t>::min()}; 1260 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 1261 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 1262 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 1263 : : std::numeric_limits<uint32_t>::min()}; 1264 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 1265 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 1266 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 1267 : 1 : value.dynamics = valueDynamics; 1268 : 1 : bool valueHasPriority{true}; 1269 : 1 : value.hasPriority = valueHasPriority; 1270 : 1 : bool valueIsInCorrectLane{true}; 1271 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 1272 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 1273 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 1274 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 1275 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 1276 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 1277 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 1278 : 1 : value.objectType = valueObjectType; 1279 : 1 : ::ad::rss::world::ObjectState valueObjectState; 1280 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 1281 : 1 : valueObjectState.yaw = valueObjectStateYaw; 1282 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 1283 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 1284 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 1285 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 1286 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 1287 : 1 : valueObjectState.dimension = valueObjectStateDimension; 1288 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 1289 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 1290 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 1291 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 1292 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 1293 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 1294 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 1295 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 1296 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 1297 : 1 : valueObjectState.speed = valueObjectStateSpeed; 1298 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 1299 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 1300 : 1 : value.objectState = valueObjectState; 1301 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 1302 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 1303 : : 1304 : : // override member with data type value below input range minimum 1305 : 1 : ::ad::rss::world::ObjectType invalidInitializedMember(static_cast<::ad::rss::world::ObjectType>(-1)); 1306 : 1 : value.objectType = invalidInitializedMember; 1307 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1308 : : } 1309 : : 1310 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeObjectTypeTooBig) 1311 : : { 1312 : 1 : ::ad::rss::situation::VehicleState value; 1313 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 1314 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 1315 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 1316 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 1317 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 1318 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 1319 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 1320 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 1321 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 1322 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 1323 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 1324 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 1325 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 1326 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 1327 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 1328 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 1329 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 1330 : 1 : value.velocity = valueVelocity; 1331 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 1332 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 1333 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 1334 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1335 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 1336 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 1337 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 1338 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 1339 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 1340 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 1341 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 1342 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 1343 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 1344 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 1345 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 1346 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 1347 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 1348 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 1349 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1350 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 1351 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 1352 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 1353 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 1354 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 1355 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 1356 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 1357 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 1358 : : valueDynamicsResponseTime 1359 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 1360 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 1361 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 1362 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 1363 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 1364 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 1365 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 1366 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 1367 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 1368 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 1369 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 1370 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 1371 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 1372 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 1373 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 1374 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 1375 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 1376 : : std::numeric_limits<uint32_t>::min()}; 1377 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 1378 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 1379 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 1380 : : std::numeric_limits<uint32_t>::min()}; 1381 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 1382 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 1383 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 1384 : : std::numeric_limits<uint32_t>::min()}; 1385 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 1386 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 1387 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 1388 : : std::numeric_limits<uint32_t>::min()}; 1389 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 1390 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 1391 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 1392 : 1 : value.dynamics = valueDynamics; 1393 : 1 : bool valueHasPriority{true}; 1394 : 1 : value.hasPriority = valueHasPriority; 1395 : 1 : bool valueIsInCorrectLane{true}; 1396 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 1397 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 1398 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 1399 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 1400 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 1401 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 1402 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 1403 : 1 : value.objectType = valueObjectType; 1404 : 1 : ::ad::rss::world::ObjectState valueObjectState; 1405 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 1406 : 1 : valueObjectState.yaw = valueObjectStateYaw; 1407 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 1408 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 1409 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 1410 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 1411 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 1412 : 1 : valueObjectState.dimension = valueObjectStateDimension; 1413 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 1414 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 1415 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 1416 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 1417 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 1418 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 1419 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 1420 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 1421 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 1422 : 1 : valueObjectState.speed = valueObjectStateSpeed; 1423 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 1424 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 1425 : 1 : value.objectState = valueObjectState; 1426 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 1427 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 1428 : : 1429 : : // override member with data type value above input range maximum 1430 : 1 : ::ad::rss::world::ObjectType invalidInitializedMember(static_cast<::ad::rss::world::ObjectType>(-1)); 1431 : 1 : value.objectType = invalidInitializedMember; 1432 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1433 : : } 1434 : : 1435 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeObjectStateTooSmall) 1436 : : { 1437 : 1 : ::ad::rss::situation::VehicleState value; 1438 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 1439 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 1440 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 1441 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 1442 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 1443 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 1444 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 1445 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 1446 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 1447 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 1448 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 1449 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 1450 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 1451 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 1452 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 1453 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 1454 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 1455 : 1 : value.velocity = valueVelocity; 1456 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 1457 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 1458 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 1459 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1460 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 1461 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 1462 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 1463 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 1464 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 1465 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 1466 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 1467 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 1468 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 1469 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 1470 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 1471 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 1472 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 1473 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 1474 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1475 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 1476 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 1477 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 1478 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 1479 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 1480 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 1481 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 1482 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 1483 : : valueDynamicsResponseTime 1484 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 1485 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 1486 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 1487 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 1488 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 1489 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 1490 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 1491 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 1492 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 1493 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 1494 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 1495 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 1496 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 1497 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 1498 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 1499 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 1500 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 1501 : : std::numeric_limits<uint32_t>::min()}; 1502 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 1503 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 1504 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 1505 : : std::numeric_limits<uint32_t>::min()}; 1506 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 1507 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 1508 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 1509 : : std::numeric_limits<uint32_t>::min()}; 1510 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 1511 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 1512 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 1513 : : std::numeric_limits<uint32_t>::min()}; 1514 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 1515 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 1516 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 1517 : 1 : value.dynamics = valueDynamics; 1518 : 1 : bool valueHasPriority{true}; 1519 : 1 : value.hasPriority = valueHasPriority; 1520 : 1 : bool valueIsInCorrectLane{true}; 1521 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 1522 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 1523 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 1524 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 1525 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 1526 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 1527 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 1528 : 1 : value.objectType = valueObjectType; 1529 : 1 : ::ad::rss::world::ObjectState valueObjectState; 1530 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 1531 : 1 : valueObjectState.yaw = valueObjectStateYaw; 1532 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 1533 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 1534 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 1535 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 1536 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 1537 : 1 : valueObjectState.dimension = valueObjectStateDimension; 1538 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 1539 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 1540 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 1541 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 1542 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 1543 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 1544 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 1545 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 1546 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 1547 : 1 : valueObjectState.speed = valueObjectStateSpeed; 1548 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 1549 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 1550 : 1 : value.objectState = valueObjectState; 1551 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 1552 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 1553 : : 1554 : : // override member with data type value below input range minimum 1555 : 1 : ::ad::rss::world::ObjectState invalidInitializedMember; 1556 : 1 : ::ad::physics::Angle invalidInitializedMemberYaw(-6.283185308 * 1.1); 1557 : 1 : invalidInitializedMember.yaw = invalidInitializedMemberYaw; 1558 : 1 : value.objectState = invalidInitializedMember; 1559 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1560 : : } 1561 : : 1562 : 2 : TEST(VehicleStateValidInputRangeTests, testValidInputRangeObjectStateTooBig) 1563 : : { 1564 : 1 : ::ad::rss::situation::VehicleState value; 1565 : 1 : ::ad::rss::situation::VelocityRange valueVelocity; 1566 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLon; 1567 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMinimum(-100.); 1568 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLonMinimum; 1569 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMaximum(-100.); 1570 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLonMaximum; 1571 : 1 : valueVelocitySpeedLon.maximum = valueVelocitySpeedLon.minimum; 1572 : 1 : valueVelocitySpeedLon.minimum = valueVelocitySpeedLon.maximum; 1573 : 1 : valueVelocity.speedLon = valueVelocitySpeedLon; 1574 : 1 : ::ad::physics::SpeedRange valueVelocitySpeedLat; 1575 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMinimum(-100.); 1576 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLatMinimum; 1577 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMaximum(-100.); 1578 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLatMaximum; 1579 : 1 : valueVelocitySpeedLat.maximum = valueVelocitySpeedLat.minimum; 1580 : 1 : valueVelocitySpeedLat.minimum = valueVelocitySpeedLat.maximum; 1581 : 1 : valueVelocity.speedLat = valueVelocitySpeedLat; 1582 : 1 : value.velocity = valueVelocity; 1583 : 1 : ::ad::rss::world::RssDynamics valueDynamics; 1584 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues valueDynamicsAlphaLon; 1585 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonAccelMax(-1e2); 1586 : 1 : valueDynamicsAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1587 : 1 : valueDynamicsAlphaLon.accelMax = valueDynamicsAlphaLonAccelMax; 1588 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMax(-1e2); 1589 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLonBrakeMax; 1590 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMin(-1e2); 1591 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLonBrakeMin; 1592 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLonBrakeMinCorrect(-1e2); 1593 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLonBrakeMinCorrect; 1594 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMax; 1595 : 1 : valueDynamicsAlphaLon.brakeMinCorrect = valueDynamicsAlphaLon.brakeMin; 1596 : 1 : valueDynamicsAlphaLon.brakeMin = valueDynamicsAlphaLon.brakeMinCorrect; 1597 : 1 : valueDynamicsAlphaLon.brakeMax = valueDynamicsAlphaLon.brakeMin; 1598 : 1 : valueDynamics.alphaLon = valueDynamicsAlphaLon; 1599 : 1 : ::ad::rss::world::LateralRssAccelerationValues valueDynamicsAlphaLat; 1600 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatAccelMax(-1e2); 1601 : 1 : valueDynamicsAlphaLatAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 1602 : 1 : valueDynamicsAlphaLat.accelMax = valueDynamicsAlphaLatAccelMax; 1603 : 1 : ::ad::physics::Acceleration valueDynamicsAlphaLatBrakeMin(-1e2); 1604 : 1 : valueDynamicsAlphaLat.brakeMin = valueDynamicsAlphaLatBrakeMin; 1605 : 1 : valueDynamics.alphaLat = valueDynamicsAlphaLat; 1606 : 1 : ::ad::physics::Distance valueDynamicsLateralFluctuationMargin(-1e9); 1607 : 1 : valueDynamicsLateralFluctuationMargin = ::ad::physics::Distance(0.); // set to valid value within struct 1608 : 1 : valueDynamics.lateralFluctuationMargin = valueDynamicsLateralFluctuationMargin; 1609 : 1 : ::ad::physics::Duration valueDynamicsResponseTime(0.); 1610 : : valueDynamicsResponseTime 1611 : 1 : = ::ad::physics::Duration(0. + ::ad::physics::Duration::cPrecisionValue); // set to valid value within struct 1612 : 1 : valueDynamics.responseTime = valueDynamicsResponseTime; 1613 : 1 : ::ad::physics::Speed valueDynamicsMaxSpeedOnAcceleration(-100.); 1614 : 1 : valueDynamics.maxSpeedOnAcceleration = valueDynamicsMaxSpeedOnAcceleration; 1615 : 1 : ::ad::rss::world::UnstructuredSettings valueDynamicsUnstructuredSettings; 1616 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsPedestrianTurningRadius(-1e9); 1617 : 1 : valueDynamicsUnstructuredSettings.pedestrianTurningRadius = valueDynamicsUnstructuredSettingsPedestrianTurningRadius; 1618 : 1 : ::ad::physics::Angle valueDynamicsUnstructuredSettingsDriveAwayMaxAngle(-6.283185308); 1619 : 1 : valueDynamicsUnstructuredSettings.driveAwayMaxAngle = valueDynamicsUnstructuredSettingsDriveAwayMaxAngle; 1620 : 1 : ::ad::physics::AngularAcceleration valueDynamicsUnstructuredSettingsVehicleYawRateChange(-1e2); 1621 : 1 : valueDynamicsUnstructuredSettings.vehicleYawRateChange = valueDynamicsUnstructuredSettingsVehicleYawRateChange; 1622 : 1 : ::ad::physics::Distance valueDynamicsUnstructuredSettingsVehicleMinRadius(-1e9); 1623 : 1 : valueDynamicsUnstructuredSettings.vehicleMinRadius = valueDynamicsUnstructuredSettingsVehicleMinRadius; 1624 : 1 : ::ad::physics::Duration valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep(0.); 1625 : : valueDynamicsUnstructuredSettings.vehicleTrajectoryCalculationStep 1626 : 1 : = valueDynamicsUnstructuredSettingsVehicleTrajectoryCalculationStep; 1627 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps{ 1628 : : std::numeric_limits<uint32_t>::min()}; 1629 : : valueDynamicsUnstructuredSettings.vehicleFrontIntermediateYawRateChangeRatioSteps 1630 : 1 : = valueDynamicsUnstructuredSettingsVehicleFrontIntermediateYawRateChangeRatioSteps; 1631 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps{ 1632 : : std::numeric_limits<uint32_t>::min()}; 1633 : : valueDynamicsUnstructuredSettings.vehicleBackIntermediateYawRateChangeRatioSteps 1634 : 1 : = valueDynamicsUnstructuredSettingsVehicleBackIntermediateYawRateChangeRatioSteps; 1635 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps{ 1636 : : std::numeric_limits<uint32_t>::min()}; 1637 : : valueDynamicsUnstructuredSettings.vehicleBrakeIntermediateAccelerationSteps 1638 : 1 : = valueDynamicsUnstructuredSettingsVehicleBrakeIntermediateAccelerationSteps; 1639 : 1 : uint32_t valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps{ 1640 : : std::numeric_limits<uint32_t>::min()}; 1641 : : valueDynamicsUnstructuredSettings.vehicleContinueForwardIntermediateAccelerationSteps 1642 : 1 : = valueDynamicsUnstructuredSettingsVehicleContinueForwardIntermediateAccelerationSteps; 1643 : 1 : valueDynamics.unstructuredSettings = valueDynamicsUnstructuredSettings; 1644 : 1 : value.dynamics = valueDynamics; 1645 : 1 : bool valueHasPriority{true}; 1646 : 1 : value.hasPriority = valueHasPriority; 1647 : 1 : bool valueIsInCorrectLane{true}; 1648 : 1 : value.isInCorrectLane = valueIsInCorrectLane; 1649 : 1 : ::ad::physics::Distance valueDistanceToEnterIntersection(-1e9); 1650 : 1 : valueDistanceToEnterIntersection = ::ad::physics::Distance(0.); // set to valid value within struct 1651 : 1 : value.distanceToEnterIntersection = valueDistanceToEnterIntersection; 1652 : 1 : ::ad::physics::Distance valueDistanceToLeaveIntersection(-1e9); 1653 : 1 : value.distanceToLeaveIntersection = valueDistanceToLeaveIntersection; 1654 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 1655 : 1 : value.objectType = valueObjectType; 1656 : 1 : ::ad::rss::world::ObjectState valueObjectState; 1657 : 1 : ::ad::physics::Angle valueObjectStateYaw(-6.283185308); 1658 : 1 : valueObjectState.yaw = valueObjectStateYaw; 1659 : 1 : ::ad::physics::Dimension2D valueObjectStateDimension; 1660 : 1 : ::ad::physics::Distance valueObjectStateDimensionLength(-1e9); 1661 : 1 : valueObjectStateDimension.length = valueObjectStateDimensionLength; 1662 : 1 : ::ad::physics::Distance valueObjectStateDimensionWidth(-1e9); 1663 : 1 : valueObjectStateDimension.width = valueObjectStateDimensionWidth; 1664 : 1 : valueObjectState.dimension = valueObjectStateDimension; 1665 : 1 : ::ad::physics::AngularVelocity valueObjectStateYawRate(-100.); 1666 : 1 : valueObjectState.yawRate = valueObjectStateYawRate; 1667 : 1 : ::ad::physics::Distance2D valueObjectStateCenterPoint; 1668 : 1 : ::ad::physics::Distance valueObjectStateCenterPointX(-1e9); 1669 : 1 : valueObjectStateCenterPoint.x = valueObjectStateCenterPointX; 1670 : 1 : ::ad::physics::Distance valueObjectStateCenterPointY(-1e9); 1671 : 1 : valueObjectStateCenterPoint.y = valueObjectStateCenterPointY; 1672 : 1 : valueObjectState.centerPoint = valueObjectStateCenterPoint; 1673 : 1 : ::ad::physics::Speed valueObjectStateSpeed(-100.); 1674 : 1 : valueObjectState.speed = valueObjectStateSpeed; 1675 : 1 : ::ad::physics::Angle valueObjectStateSteeringAngle(-6.283185308); 1676 : 1 : valueObjectState.steeringAngle = valueObjectStateSteeringAngle; 1677 : 1 : value.objectState = valueObjectState; 1678 : 1 : value.distanceToLeaveIntersection = value.distanceToEnterIntersection; 1679 : 1 : value.distanceToEnterIntersection = value.distanceToLeaveIntersection; 1680 : : 1681 : : // override member with data type value above input range maximum 1682 : 1 : ::ad::rss::world::ObjectState invalidInitializedMember; 1683 : 1 : ::ad::physics::Angle invalidInitializedMemberYaw(6.283185308 * 1.1); 1684 : 1 : invalidInitializedMember.yaw = invalidInitializedMemberYaw; 1685 : 1 : value.objectState = invalidInitializedMember; 1686 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 1687 : : }