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/world/ObjectValidInputRange.hpp" 20 : : 21 : 2 : TEST(ObjectValidInputRangeTests, testValidInputRange) 22 : : { 23 : 1 : ::ad::rss::world::Object value; 24 : 1 : ::ad::rss::world::ObjectId valueObjectId(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 25 : 1 : value.objectId = valueObjectId; 26 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 27 : 1 : value.objectType = valueObjectType; 28 : 1 : ::ad::rss::world::OccupiedRegionVector valueOccupiedRegions; 29 : 1 : ::ad::rss::world::OccupiedRegion valueOccupiedRegionsElement; 30 : 1 : ::ad::rss::world::LaneSegmentId valueOccupiedRegionsElementSegmentId( 31 : : std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 32 : 1 : valueOccupiedRegionsElement.segmentId = valueOccupiedRegionsElementSegmentId; 33 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLonRange; 34 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMinimum(0.); 35 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRangeMinimum; 36 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMaximum(0.); 37 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRangeMaximum; 38 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRange.minimum; 39 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRange.maximum; 40 : 1 : valueOccupiedRegionsElement.lonRange = valueOccupiedRegionsElementLonRange; 41 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLatRange; 42 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMinimum(0.); 43 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRangeMinimum; 44 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMaximum(0.); 45 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRangeMaximum; 46 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRange.minimum; 47 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRange.maximum; 48 : 1 : valueOccupiedRegionsElement.latRange = valueOccupiedRegionsElementLatRange; 49 [ + - ]: 1 : valueOccupiedRegions.resize(1, valueOccupiedRegionsElement); 50 [ + - ]: 1 : value.occupiedRegions = valueOccupiedRegions; 51 : 1 : ::ad::rss::world::Velocity valueVelocity; 52 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMin(-100.); 53 : 1 : valueVelocitySpeedLonMin = ::ad::physics::Speed(0.); // set to valid value within struct 54 : 1 : valueVelocity.speedLonMin = valueVelocitySpeedLonMin; 55 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMax(-100.); 56 : 1 : valueVelocity.speedLonMax = valueVelocitySpeedLonMax; 57 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMin(-100.); 58 : 1 : valueVelocity.speedLatMin = valueVelocitySpeedLatMin; 59 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMax(-100.); 60 : 1 : valueVelocity.speedLatMax = valueVelocitySpeedLatMax; 61 : 1 : valueVelocity.speedLonMax = valueVelocity.speedLonMin; 62 : 1 : valueVelocity.speedLatMax = valueVelocity.speedLatMin; 63 : 1 : valueVelocity.speedLonMin = valueVelocity.speedLonMax; 64 : 1 : valueVelocity.speedLatMin = valueVelocity.speedLatMax; 65 : 1 : value.velocity = valueVelocity; 66 : 1 : ::ad::rss::world::ObjectState valueState; 67 : 1 : ::ad::physics::Angle valueStateYaw(-6.283185308); 68 : 1 : valueState.yaw = valueStateYaw; 69 : 1 : ::ad::physics::Dimension2D valueStateDimension; 70 : 1 : ::ad::physics::Distance valueStateDimensionLength(-1e9); 71 : 1 : valueStateDimension.length = valueStateDimensionLength; 72 : 1 : ::ad::physics::Distance valueStateDimensionWidth(-1e9); 73 : 1 : valueStateDimension.width = valueStateDimensionWidth; 74 : 1 : valueState.dimension = valueStateDimension; 75 : 1 : ::ad::physics::AngularVelocity valueStateYawRate(-100.); 76 : 1 : valueState.yawRate = valueStateYawRate; 77 : 1 : ::ad::physics::Distance2D valueStateCenterPoint; 78 : 1 : ::ad::physics::Distance valueStateCenterPointX(-1e9); 79 : 1 : valueStateCenterPoint.x = valueStateCenterPointX; 80 : 1 : ::ad::physics::Distance valueStateCenterPointY(-1e9); 81 : 1 : valueStateCenterPoint.y = valueStateCenterPointY; 82 : 1 : valueState.centerPoint = valueStateCenterPoint; 83 : 1 : ::ad::physics::Speed valueStateSpeed(-100.); 84 : 1 : valueState.speed = valueStateSpeed; 85 : 1 : ::ad::physics::Angle valueStateSteeringAngle(-6.283185308); 86 : 1 : valueState.steeringAngle = valueStateSteeringAngle; 87 : 1 : value.state = valueState; 88 [ + - - + : 1 : ASSERT_TRUE(withinValidInputRange(value)); - - - - - - - - ] 89 : : } 90 : : 91 : 2 : TEST(ObjectValidInputRangeTests, testValidInputRangeObjectTypeTooSmall) 92 : : { 93 : 1 : ::ad::rss::world::Object value; 94 : 1 : ::ad::rss::world::ObjectId valueObjectId(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 95 : 1 : value.objectId = valueObjectId; 96 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 97 : 1 : value.objectType = valueObjectType; 98 : 1 : ::ad::rss::world::OccupiedRegionVector valueOccupiedRegions; 99 : 1 : ::ad::rss::world::OccupiedRegion valueOccupiedRegionsElement; 100 : 1 : ::ad::rss::world::LaneSegmentId valueOccupiedRegionsElementSegmentId( 101 : : std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 102 : 1 : valueOccupiedRegionsElement.segmentId = valueOccupiedRegionsElementSegmentId; 103 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLonRange; 104 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMinimum(0.); 105 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRangeMinimum; 106 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMaximum(0.); 107 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRangeMaximum; 108 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRange.minimum; 109 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRange.maximum; 110 : 1 : valueOccupiedRegionsElement.lonRange = valueOccupiedRegionsElementLonRange; 111 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLatRange; 112 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMinimum(0.); 113 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRangeMinimum; 114 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMaximum(0.); 115 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRangeMaximum; 116 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRange.minimum; 117 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRange.maximum; 118 : 1 : valueOccupiedRegionsElement.latRange = valueOccupiedRegionsElementLatRange; 119 [ + - ]: 1 : valueOccupiedRegions.resize(1, valueOccupiedRegionsElement); 120 [ + - ]: 1 : value.occupiedRegions = valueOccupiedRegions; 121 : 1 : ::ad::rss::world::Velocity valueVelocity; 122 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMin(-100.); 123 : 1 : valueVelocitySpeedLonMin = ::ad::physics::Speed(0.); // set to valid value within struct 124 : 1 : valueVelocity.speedLonMin = valueVelocitySpeedLonMin; 125 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMax(-100.); 126 : 1 : valueVelocity.speedLonMax = valueVelocitySpeedLonMax; 127 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMin(-100.); 128 : 1 : valueVelocity.speedLatMin = valueVelocitySpeedLatMin; 129 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMax(-100.); 130 : 1 : valueVelocity.speedLatMax = valueVelocitySpeedLatMax; 131 : 1 : valueVelocity.speedLonMax = valueVelocity.speedLonMin; 132 : 1 : valueVelocity.speedLatMax = valueVelocity.speedLatMin; 133 : 1 : valueVelocity.speedLonMin = valueVelocity.speedLonMax; 134 : 1 : valueVelocity.speedLatMin = valueVelocity.speedLatMax; 135 : 1 : value.velocity = valueVelocity; 136 : 1 : ::ad::rss::world::ObjectState valueState; 137 : 1 : ::ad::physics::Angle valueStateYaw(-6.283185308); 138 : 1 : valueState.yaw = valueStateYaw; 139 : 1 : ::ad::physics::Dimension2D valueStateDimension; 140 : 1 : ::ad::physics::Distance valueStateDimensionLength(-1e9); 141 : 1 : valueStateDimension.length = valueStateDimensionLength; 142 : 1 : ::ad::physics::Distance valueStateDimensionWidth(-1e9); 143 : 1 : valueStateDimension.width = valueStateDimensionWidth; 144 : 1 : valueState.dimension = valueStateDimension; 145 : 1 : ::ad::physics::AngularVelocity valueStateYawRate(-100.); 146 : 1 : valueState.yawRate = valueStateYawRate; 147 : 1 : ::ad::physics::Distance2D valueStateCenterPoint; 148 : 1 : ::ad::physics::Distance valueStateCenterPointX(-1e9); 149 : 1 : valueStateCenterPoint.x = valueStateCenterPointX; 150 : 1 : ::ad::physics::Distance valueStateCenterPointY(-1e9); 151 : 1 : valueStateCenterPoint.y = valueStateCenterPointY; 152 : 1 : valueState.centerPoint = valueStateCenterPoint; 153 : 1 : ::ad::physics::Speed valueStateSpeed(-100.); 154 : 1 : valueState.speed = valueStateSpeed; 155 : 1 : ::ad::physics::Angle valueStateSteeringAngle(-6.283185308); 156 : 1 : valueState.steeringAngle = valueStateSteeringAngle; 157 : 1 : value.state = valueState; 158 : : 159 : : // override member with data type value below input range minimum 160 : 1 : ::ad::rss::world::ObjectType invalidInitializedMember(static_cast<::ad::rss::world::ObjectType>(-1)); 161 : 1 : value.objectType = invalidInitializedMember; 162 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 163 : : } 164 : : 165 : 2 : TEST(ObjectValidInputRangeTests, testValidInputRangeObjectTypeTooBig) 166 : : { 167 : 1 : ::ad::rss::world::Object value; 168 : 1 : ::ad::rss::world::ObjectId valueObjectId(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 169 : 1 : value.objectId = valueObjectId; 170 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 171 : 1 : value.objectType = valueObjectType; 172 : 1 : ::ad::rss::world::OccupiedRegionVector valueOccupiedRegions; 173 : 1 : ::ad::rss::world::OccupiedRegion valueOccupiedRegionsElement; 174 : 1 : ::ad::rss::world::LaneSegmentId valueOccupiedRegionsElementSegmentId( 175 : : std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 176 : 1 : valueOccupiedRegionsElement.segmentId = valueOccupiedRegionsElementSegmentId; 177 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLonRange; 178 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMinimum(0.); 179 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRangeMinimum; 180 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMaximum(0.); 181 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRangeMaximum; 182 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRange.minimum; 183 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRange.maximum; 184 : 1 : valueOccupiedRegionsElement.lonRange = valueOccupiedRegionsElementLonRange; 185 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLatRange; 186 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMinimum(0.); 187 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRangeMinimum; 188 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMaximum(0.); 189 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRangeMaximum; 190 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRange.minimum; 191 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRange.maximum; 192 : 1 : valueOccupiedRegionsElement.latRange = valueOccupiedRegionsElementLatRange; 193 [ + - ]: 1 : valueOccupiedRegions.resize(1, valueOccupiedRegionsElement); 194 [ + - ]: 1 : value.occupiedRegions = valueOccupiedRegions; 195 : 1 : ::ad::rss::world::Velocity valueVelocity; 196 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMin(-100.); 197 : 1 : valueVelocitySpeedLonMin = ::ad::physics::Speed(0.); // set to valid value within struct 198 : 1 : valueVelocity.speedLonMin = valueVelocitySpeedLonMin; 199 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMax(-100.); 200 : 1 : valueVelocity.speedLonMax = valueVelocitySpeedLonMax; 201 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMin(-100.); 202 : 1 : valueVelocity.speedLatMin = valueVelocitySpeedLatMin; 203 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMax(-100.); 204 : 1 : valueVelocity.speedLatMax = valueVelocitySpeedLatMax; 205 : 1 : valueVelocity.speedLonMax = valueVelocity.speedLonMin; 206 : 1 : valueVelocity.speedLatMax = valueVelocity.speedLatMin; 207 : 1 : valueVelocity.speedLonMin = valueVelocity.speedLonMax; 208 : 1 : valueVelocity.speedLatMin = valueVelocity.speedLatMax; 209 : 1 : value.velocity = valueVelocity; 210 : 1 : ::ad::rss::world::ObjectState valueState; 211 : 1 : ::ad::physics::Angle valueStateYaw(-6.283185308); 212 : 1 : valueState.yaw = valueStateYaw; 213 : 1 : ::ad::physics::Dimension2D valueStateDimension; 214 : 1 : ::ad::physics::Distance valueStateDimensionLength(-1e9); 215 : 1 : valueStateDimension.length = valueStateDimensionLength; 216 : 1 : ::ad::physics::Distance valueStateDimensionWidth(-1e9); 217 : 1 : valueStateDimension.width = valueStateDimensionWidth; 218 : 1 : valueState.dimension = valueStateDimension; 219 : 1 : ::ad::physics::AngularVelocity valueStateYawRate(-100.); 220 : 1 : valueState.yawRate = valueStateYawRate; 221 : 1 : ::ad::physics::Distance2D valueStateCenterPoint; 222 : 1 : ::ad::physics::Distance valueStateCenterPointX(-1e9); 223 : 1 : valueStateCenterPoint.x = valueStateCenterPointX; 224 : 1 : ::ad::physics::Distance valueStateCenterPointY(-1e9); 225 : 1 : valueStateCenterPoint.y = valueStateCenterPointY; 226 : 1 : valueState.centerPoint = valueStateCenterPoint; 227 : 1 : ::ad::physics::Speed valueStateSpeed(-100.); 228 : 1 : valueState.speed = valueStateSpeed; 229 : 1 : ::ad::physics::Angle valueStateSteeringAngle(-6.283185308); 230 : 1 : valueState.steeringAngle = valueStateSteeringAngle; 231 : 1 : value.state = valueState; 232 : : 233 : : // override member with data type value above input range maximum 234 : 1 : ::ad::rss::world::ObjectType invalidInitializedMember(static_cast<::ad::rss::world::ObjectType>(-1)); 235 : 1 : value.objectType = invalidInitializedMember; 236 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 237 : : } 238 : : 239 : 2 : TEST(ObjectValidInputRangeTests, testValidInputRangeVelocityTooSmall) 240 : : { 241 : 1 : ::ad::rss::world::Object value; 242 : 1 : ::ad::rss::world::ObjectId valueObjectId(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 243 : 1 : value.objectId = valueObjectId; 244 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 245 : 1 : value.objectType = valueObjectType; 246 : 1 : ::ad::rss::world::OccupiedRegionVector valueOccupiedRegions; 247 : 1 : ::ad::rss::world::OccupiedRegion valueOccupiedRegionsElement; 248 : 1 : ::ad::rss::world::LaneSegmentId valueOccupiedRegionsElementSegmentId( 249 : : std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 250 : 1 : valueOccupiedRegionsElement.segmentId = valueOccupiedRegionsElementSegmentId; 251 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLonRange; 252 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMinimum(0.); 253 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRangeMinimum; 254 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMaximum(0.); 255 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRangeMaximum; 256 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRange.minimum; 257 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRange.maximum; 258 : 1 : valueOccupiedRegionsElement.lonRange = valueOccupiedRegionsElementLonRange; 259 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLatRange; 260 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMinimum(0.); 261 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRangeMinimum; 262 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMaximum(0.); 263 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRangeMaximum; 264 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRange.minimum; 265 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRange.maximum; 266 : 1 : valueOccupiedRegionsElement.latRange = valueOccupiedRegionsElementLatRange; 267 [ + - ]: 1 : valueOccupiedRegions.resize(1, valueOccupiedRegionsElement); 268 [ + - ]: 1 : value.occupiedRegions = valueOccupiedRegions; 269 : 1 : ::ad::rss::world::Velocity valueVelocity; 270 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMin(-100.); 271 : 1 : valueVelocitySpeedLonMin = ::ad::physics::Speed(0.); // set to valid value within struct 272 : 1 : valueVelocity.speedLonMin = valueVelocitySpeedLonMin; 273 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMax(-100.); 274 : 1 : valueVelocity.speedLonMax = valueVelocitySpeedLonMax; 275 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMin(-100.); 276 : 1 : valueVelocity.speedLatMin = valueVelocitySpeedLatMin; 277 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMax(-100.); 278 : 1 : valueVelocity.speedLatMax = valueVelocitySpeedLatMax; 279 : 1 : valueVelocity.speedLonMax = valueVelocity.speedLonMin; 280 : 1 : valueVelocity.speedLatMax = valueVelocity.speedLatMin; 281 : 1 : valueVelocity.speedLonMin = valueVelocity.speedLonMax; 282 : 1 : valueVelocity.speedLatMin = valueVelocity.speedLatMax; 283 : 1 : value.velocity = valueVelocity; 284 : 1 : ::ad::rss::world::ObjectState valueState; 285 : 1 : ::ad::physics::Angle valueStateYaw(-6.283185308); 286 : 1 : valueState.yaw = valueStateYaw; 287 : 1 : ::ad::physics::Dimension2D valueStateDimension; 288 : 1 : ::ad::physics::Distance valueStateDimensionLength(-1e9); 289 : 1 : valueStateDimension.length = valueStateDimensionLength; 290 : 1 : ::ad::physics::Distance valueStateDimensionWidth(-1e9); 291 : 1 : valueStateDimension.width = valueStateDimensionWidth; 292 : 1 : valueState.dimension = valueStateDimension; 293 : 1 : ::ad::physics::AngularVelocity valueStateYawRate(-100.); 294 : 1 : valueState.yawRate = valueStateYawRate; 295 : 1 : ::ad::physics::Distance2D valueStateCenterPoint; 296 : 1 : ::ad::physics::Distance valueStateCenterPointX(-1e9); 297 : 1 : valueStateCenterPoint.x = valueStateCenterPointX; 298 : 1 : ::ad::physics::Distance valueStateCenterPointY(-1e9); 299 : 1 : valueStateCenterPoint.y = valueStateCenterPointY; 300 : 1 : valueState.centerPoint = valueStateCenterPoint; 301 : 1 : ::ad::physics::Speed valueStateSpeed(-100.); 302 : 1 : valueState.speed = valueStateSpeed; 303 : 1 : ::ad::physics::Angle valueStateSteeringAngle(-6.283185308); 304 : 1 : valueState.steeringAngle = valueStateSteeringAngle; 305 : 1 : value.state = valueState; 306 : : 307 : : // override member with data type value below input range minimum 308 : 1 : ::ad::rss::world::Velocity invalidInitializedMember; 309 : 1 : ::ad::physics::Speed invalidInitializedMemberSpeedLonMin(-100. * 1.1); 310 : 1 : invalidInitializedMember.speedLonMin = invalidInitializedMemberSpeedLonMin; 311 : 1 : value.velocity = invalidInitializedMember; 312 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 313 : : } 314 : : 315 : 2 : TEST(ObjectValidInputRangeTests, testValidInputRangeVelocityTooBig) 316 : : { 317 : 1 : ::ad::rss::world::Object value; 318 : 1 : ::ad::rss::world::ObjectId valueObjectId(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 319 : 1 : value.objectId = valueObjectId; 320 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 321 : 1 : value.objectType = valueObjectType; 322 : 1 : ::ad::rss::world::OccupiedRegionVector valueOccupiedRegions; 323 : 1 : ::ad::rss::world::OccupiedRegion valueOccupiedRegionsElement; 324 : 1 : ::ad::rss::world::LaneSegmentId valueOccupiedRegionsElementSegmentId( 325 : : std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 326 : 1 : valueOccupiedRegionsElement.segmentId = valueOccupiedRegionsElementSegmentId; 327 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLonRange; 328 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMinimum(0.); 329 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRangeMinimum; 330 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMaximum(0.); 331 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRangeMaximum; 332 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRange.minimum; 333 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRange.maximum; 334 : 1 : valueOccupiedRegionsElement.lonRange = valueOccupiedRegionsElementLonRange; 335 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLatRange; 336 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMinimum(0.); 337 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRangeMinimum; 338 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMaximum(0.); 339 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRangeMaximum; 340 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRange.minimum; 341 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRange.maximum; 342 : 1 : valueOccupiedRegionsElement.latRange = valueOccupiedRegionsElementLatRange; 343 [ + - ]: 1 : valueOccupiedRegions.resize(1, valueOccupiedRegionsElement); 344 [ + - ]: 1 : value.occupiedRegions = valueOccupiedRegions; 345 : 1 : ::ad::rss::world::Velocity valueVelocity; 346 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMin(-100.); 347 : 1 : valueVelocitySpeedLonMin = ::ad::physics::Speed(0.); // set to valid value within struct 348 : 1 : valueVelocity.speedLonMin = valueVelocitySpeedLonMin; 349 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMax(-100.); 350 : 1 : valueVelocity.speedLonMax = valueVelocitySpeedLonMax; 351 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMin(-100.); 352 : 1 : valueVelocity.speedLatMin = valueVelocitySpeedLatMin; 353 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMax(-100.); 354 : 1 : valueVelocity.speedLatMax = valueVelocitySpeedLatMax; 355 : 1 : valueVelocity.speedLonMax = valueVelocity.speedLonMin; 356 : 1 : valueVelocity.speedLatMax = valueVelocity.speedLatMin; 357 : 1 : valueVelocity.speedLonMin = valueVelocity.speedLonMax; 358 : 1 : valueVelocity.speedLatMin = valueVelocity.speedLatMax; 359 : 1 : value.velocity = valueVelocity; 360 : 1 : ::ad::rss::world::ObjectState valueState; 361 : 1 : ::ad::physics::Angle valueStateYaw(-6.283185308); 362 : 1 : valueState.yaw = valueStateYaw; 363 : 1 : ::ad::physics::Dimension2D valueStateDimension; 364 : 1 : ::ad::physics::Distance valueStateDimensionLength(-1e9); 365 : 1 : valueStateDimension.length = valueStateDimensionLength; 366 : 1 : ::ad::physics::Distance valueStateDimensionWidth(-1e9); 367 : 1 : valueStateDimension.width = valueStateDimensionWidth; 368 : 1 : valueState.dimension = valueStateDimension; 369 : 1 : ::ad::physics::AngularVelocity valueStateYawRate(-100.); 370 : 1 : valueState.yawRate = valueStateYawRate; 371 : 1 : ::ad::physics::Distance2D valueStateCenterPoint; 372 : 1 : ::ad::physics::Distance valueStateCenterPointX(-1e9); 373 : 1 : valueStateCenterPoint.x = valueStateCenterPointX; 374 : 1 : ::ad::physics::Distance valueStateCenterPointY(-1e9); 375 : 1 : valueStateCenterPoint.y = valueStateCenterPointY; 376 : 1 : valueState.centerPoint = valueStateCenterPoint; 377 : 1 : ::ad::physics::Speed valueStateSpeed(-100.); 378 : 1 : valueState.speed = valueStateSpeed; 379 : 1 : ::ad::physics::Angle valueStateSteeringAngle(-6.283185308); 380 : 1 : valueState.steeringAngle = valueStateSteeringAngle; 381 : 1 : value.state = valueState; 382 : : 383 : : // override member with data type value above input range maximum 384 : 1 : ::ad::rss::world::Velocity invalidInitializedMember; 385 : 1 : ::ad::physics::Speed invalidInitializedMemberSpeedLonMin(100. * 1.1); 386 : 1 : invalidInitializedMember.speedLonMin = invalidInitializedMemberSpeedLonMin; 387 : 1 : value.velocity = invalidInitializedMember; 388 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 389 : : } 390 : : 391 : 2 : TEST(ObjectValidInputRangeTests, testValidInputRangeStateTooSmall) 392 : : { 393 : 1 : ::ad::rss::world::Object value; 394 : 1 : ::ad::rss::world::ObjectId valueObjectId(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 395 : 1 : value.objectId = valueObjectId; 396 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 397 : 1 : value.objectType = valueObjectType; 398 : 1 : ::ad::rss::world::OccupiedRegionVector valueOccupiedRegions; 399 : 1 : ::ad::rss::world::OccupiedRegion valueOccupiedRegionsElement; 400 : 1 : ::ad::rss::world::LaneSegmentId valueOccupiedRegionsElementSegmentId( 401 : : std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 402 : 1 : valueOccupiedRegionsElement.segmentId = valueOccupiedRegionsElementSegmentId; 403 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLonRange; 404 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMinimum(0.); 405 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRangeMinimum; 406 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMaximum(0.); 407 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRangeMaximum; 408 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRange.minimum; 409 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRange.maximum; 410 : 1 : valueOccupiedRegionsElement.lonRange = valueOccupiedRegionsElementLonRange; 411 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLatRange; 412 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMinimum(0.); 413 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRangeMinimum; 414 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMaximum(0.); 415 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRangeMaximum; 416 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRange.minimum; 417 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRange.maximum; 418 : 1 : valueOccupiedRegionsElement.latRange = valueOccupiedRegionsElementLatRange; 419 [ + - ]: 1 : valueOccupiedRegions.resize(1, valueOccupiedRegionsElement); 420 [ + - ]: 1 : value.occupiedRegions = valueOccupiedRegions; 421 : 1 : ::ad::rss::world::Velocity valueVelocity; 422 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMin(-100.); 423 : 1 : valueVelocitySpeedLonMin = ::ad::physics::Speed(0.); // set to valid value within struct 424 : 1 : valueVelocity.speedLonMin = valueVelocitySpeedLonMin; 425 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMax(-100.); 426 : 1 : valueVelocity.speedLonMax = valueVelocitySpeedLonMax; 427 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMin(-100.); 428 : 1 : valueVelocity.speedLatMin = valueVelocitySpeedLatMin; 429 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMax(-100.); 430 : 1 : valueVelocity.speedLatMax = valueVelocitySpeedLatMax; 431 : 1 : valueVelocity.speedLonMax = valueVelocity.speedLonMin; 432 : 1 : valueVelocity.speedLatMax = valueVelocity.speedLatMin; 433 : 1 : valueVelocity.speedLonMin = valueVelocity.speedLonMax; 434 : 1 : valueVelocity.speedLatMin = valueVelocity.speedLatMax; 435 : 1 : value.velocity = valueVelocity; 436 : 1 : ::ad::rss::world::ObjectState valueState; 437 : 1 : ::ad::physics::Angle valueStateYaw(-6.283185308); 438 : 1 : valueState.yaw = valueStateYaw; 439 : 1 : ::ad::physics::Dimension2D valueStateDimension; 440 : 1 : ::ad::physics::Distance valueStateDimensionLength(-1e9); 441 : 1 : valueStateDimension.length = valueStateDimensionLength; 442 : 1 : ::ad::physics::Distance valueStateDimensionWidth(-1e9); 443 : 1 : valueStateDimension.width = valueStateDimensionWidth; 444 : 1 : valueState.dimension = valueStateDimension; 445 : 1 : ::ad::physics::AngularVelocity valueStateYawRate(-100.); 446 : 1 : valueState.yawRate = valueStateYawRate; 447 : 1 : ::ad::physics::Distance2D valueStateCenterPoint; 448 : 1 : ::ad::physics::Distance valueStateCenterPointX(-1e9); 449 : 1 : valueStateCenterPoint.x = valueStateCenterPointX; 450 : 1 : ::ad::physics::Distance valueStateCenterPointY(-1e9); 451 : 1 : valueStateCenterPoint.y = valueStateCenterPointY; 452 : 1 : valueState.centerPoint = valueStateCenterPoint; 453 : 1 : ::ad::physics::Speed valueStateSpeed(-100.); 454 : 1 : valueState.speed = valueStateSpeed; 455 : 1 : ::ad::physics::Angle valueStateSteeringAngle(-6.283185308); 456 : 1 : valueState.steeringAngle = valueStateSteeringAngle; 457 : 1 : value.state = valueState; 458 : : 459 : : // override member with data type value below input range minimum 460 : 1 : ::ad::rss::world::ObjectState invalidInitializedMember; 461 : 1 : ::ad::physics::Angle invalidInitializedMemberYaw(-6.283185308 * 1.1); 462 : 1 : invalidInitializedMember.yaw = invalidInitializedMemberYaw; 463 : 1 : value.state = invalidInitializedMember; 464 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 465 : : } 466 : : 467 : 2 : TEST(ObjectValidInputRangeTests, testValidInputRangeStateTooBig) 468 : : { 469 : 1 : ::ad::rss::world::Object value; 470 : 1 : ::ad::rss::world::ObjectId valueObjectId(std::numeric_limits<::ad::rss::world::ObjectId>::lowest()); 471 : 1 : value.objectId = valueObjectId; 472 : 1 : ::ad::rss::world::ObjectType valueObjectType(::ad::rss::world::ObjectType::Invalid); 473 : 1 : value.objectType = valueObjectType; 474 : 1 : ::ad::rss::world::OccupiedRegionVector valueOccupiedRegions; 475 : 1 : ::ad::rss::world::OccupiedRegion valueOccupiedRegionsElement; 476 : 1 : ::ad::rss::world::LaneSegmentId valueOccupiedRegionsElementSegmentId( 477 : : std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 478 : 1 : valueOccupiedRegionsElement.segmentId = valueOccupiedRegionsElementSegmentId; 479 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLonRange; 480 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMinimum(0.); 481 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRangeMinimum; 482 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLonRangeMaximum(0.); 483 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRangeMaximum; 484 : 1 : valueOccupiedRegionsElementLonRange.maximum = valueOccupiedRegionsElementLonRange.minimum; 485 : 1 : valueOccupiedRegionsElementLonRange.minimum = valueOccupiedRegionsElementLonRange.maximum; 486 : 1 : valueOccupiedRegionsElement.lonRange = valueOccupiedRegionsElementLonRange; 487 : 1 : ::ad::physics::ParametricRange valueOccupiedRegionsElementLatRange; 488 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMinimum(0.); 489 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRangeMinimum; 490 : 1 : ::ad::physics::ParametricValue valueOccupiedRegionsElementLatRangeMaximum(0.); 491 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRangeMaximum; 492 : 1 : valueOccupiedRegionsElementLatRange.maximum = valueOccupiedRegionsElementLatRange.minimum; 493 : 1 : valueOccupiedRegionsElementLatRange.minimum = valueOccupiedRegionsElementLatRange.maximum; 494 : 1 : valueOccupiedRegionsElement.latRange = valueOccupiedRegionsElementLatRange; 495 [ + - ]: 1 : valueOccupiedRegions.resize(1, valueOccupiedRegionsElement); 496 [ + - ]: 1 : value.occupiedRegions = valueOccupiedRegions; 497 : 1 : ::ad::rss::world::Velocity valueVelocity; 498 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMin(-100.); 499 : 1 : valueVelocitySpeedLonMin = ::ad::physics::Speed(0.); // set to valid value within struct 500 : 1 : valueVelocity.speedLonMin = valueVelocitySpeedLonMin; 501 : 1 : ::ad::physics::Speed valueVelocitySpeedLonMax(-100.); 502 : 1 : valueVelocity.speedLonMax = valueVelocitySpeedLonMax; 503 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMin(-100.); 504 : 1 : valueVelocity.speedLatMin = valueVelocitySpeedLatMin; 505 : 1 : ::ad::physics::Speed valueVelocitySpeedLatMax(-100.); 506 : 1 : valueVelocity.speedLatMax = valueVelocitySpeedLatMax; 507 : 1 : valueVelocity.speedLonMax = valueVelocity.speedLonMin; 508 : 1 : valueVelocity.speedLatMax = valueVelocity.speedLatMin; 509 : 1 : valueVelocity.speedLonMin = valueVelocity.speedLonMax; 510 : 1 : valueVelocity.speedLatMin = valueVelocity.speedLatMax; 511 : 1 : value.velocity = valueVelocity; 512 : 1 : ::ad::rss::world::ObjectState valueState; 513 : 1 : ::ad::physics::Angle valueStateYaw(-6.283185308); 514 : 1 : valueState.yaw = valueStateYaw; 515 : 1 : ::ad::physics::Dimension2D valueStateDimension; 516 : 1 : ::ad::physics::Distance valueStateDimensionLength(-1e9); 517 : 1 : valueStateDimension.length = valueStateDimensionLength; 518 : 1 : ::ad::physics::Distance valueStateDimensionWidth(-1e9); 519 : 1 : valueStateDimension.width = valueStateDimensionWidth; 520 : 1 : valueState.dimension = valueStateDimension; 521 : 1 : ::ad::physics::AngularVelocity valueStateYawRate(-100.); 522 : 1 : valueState.yawRate = valueStateYawRate; 523 : 1 : ::ad::physics::Distance2D valueStateCenterPoint; 524 : 1 : ::ad::physics::Distance valueStateCenterPointX(-1e9); 525 : 1 : valueStateCenterPoint.x = valueStateCenterPointX; 526 : 1 : ::ad::physics::Distance valueStateCenterPointY(-1e9); 527 : 1 : valueStateCenterPoint.y = valueStateCenterPointY; 528 : 1 : valueState.centerPoint = valueStateCenterPoint; 529 : 1 : ::ad::physics::Speed valueStateSpeed(-100.); 530 : 1 : valueState.speed = valueStateSpeed; 531 : 1 : ::ad::physics::Angle valueStateSteeringAngle(-6.283185308); 532 : 1 : valueState.steeringAngle = valueStateSteeringAngle; 533 : 1 : value.state = valueState; 534 : : 535 : : // override member with data type value above input range maximum 536 : 1 : ::ad::rss::world::ObjectState invalidInitializedMember; 537 : 1 : ::ad::physics::Angle invalidInitializedMemberYaw(6.283185308 * 1.1); 538 : 1 : invalidInitializedMember.yaw = invalidInitializedMemberYaw; 539 : 1 : value.state = invalidInitializedMember; 540 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 541 : : }