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/LaneSegmentValidInputRange.hpp" 20 : : 21 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRange) 22 : : { 23 : 1 : ::ad::rss::world::LaneSegment value; 24 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 25 : 1 : value.id = valueId; 26 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 27 : 1 : value.type = valueType; 28 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 29 : 1 : value.drivingDirection = valueDrivingDirection; 30 : 1 : ::ad::physics::MetricRange valueLength; 31 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 32 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 33 : 1 : valueLength.minimum = valueLengthMinimum; 34 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 35 : 1 : valueLength.maximum = valueLengthMaximum; 36 : 1 : valueLength.maximum = valueLength.minimum; 37 : 1 : valueLength.minimum = valueLength.maximum; 38 : 1 : value.length = valueLength; 39 : 1 : ::ad::physics::MetricRange valueWidth; 40 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 41 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 42 : 1 : valueWidth.minimum = valueWidthMinimum; 43 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 44 : 1 : valueWidth.maximum = valueWidthMaximum; 45 : 1 : valueWidth.maximum = valueWidth.minimum; 46 : 1 : valueWidth.minimum = valueWidth.maximum; 47 : 1 : value.width = valueWidth; 48 [ + - - + : 1 : ASSERT_TRUE(withinValidInputRange(value)); - - - - - - - - ] 49 : : } 50 : : 51 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeTypeTooSmall) 52 : : { 53 : 1 : ::ad::rss::world::LaneSegment value; 54 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 55 : 1 : value.id = valueId; 56 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 57 : 1 : value.type = valueType; 58 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 59 : 1 : value.drivingDirection = valueDrivingDirection; 60 : 1 : ::ad::physics::MetricRange valueLength; 61 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 62 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 63 : 1 : valueLength.minimum = valueLengthMinimum; 64 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 65 : 1 : valueLength.maximum = valueLengthMaximum; 66 : 1 : valueLength.maximum = valueLength.minimum; 67 : 1 : valueLength.minimum = valueLength.maximum; 68 : 1 : value.length = valueLength; 69 : 1 : ::ad::physics::MetricRange valueWidth; 70 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 71 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 72 : 1 : valueWidth.minimum = valueWidthMinimum; 73 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 74 : 1 : valueWidth.maximum = valueWidthMaximum; 75 : 1 : valueWidth.maximum = valueWidth.minimum; 76 : 1 : valueWidth.minimum = valueWidth.maximum; 77 : 1 : value.width = valueWidth; 78 : : 79 : : // override member with data type value below input range minimum 80 : 1 : ::ad::rss::world::LaneSegmentType invalidInitializedMember(static_cast<::ad::rss::world::LaneSegmentType>(-1)); 81 : 1 : value.type = invalidInitializedMember; 82 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 83 : : } 84 : : 85 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeTypeTooBig) 86 : : { 87 : 1 : ::ad::rss::world::LaneSegment value; 88 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 89 : 1 : value.id = valueId; 90 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 91 : 1 : value.type = valueType; 92 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 93 : 1 : value.drivingDirection = valueDrivingDirection; 94 : 1 : ::ad::physics::MetricRange valueLength; 95 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 96 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 97 : 1 : valueLength.minimum = valueLengthMinimum; 98 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 99 : 1 : valueLength.maximum = valueLengthMaximum; 100 : 1 : valueLength.maximum = valueLength.minimum; 101 : 1 : valueLength.minimum = valueLength.maximum; 102 : 1 : value.length = valueLength; 103 : 1 : ::ad::physics::MetricRange valueWidth; 104 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 105 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 106 : 1 : valueWidth.minimum = valueWidthMinimum; 107 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 108 : 1 : valueWidth.maximum = valueWidthMaximum; 109 : 1 : valueWidth.maximum = valueWidth.minimum; 110 : 1 : valueWidth.minimum = valueWidth.maximum; 111 : 1 : value.width = valueWidth; 112 : : 113 : : // override member with data type value above input range maximum 114 : 1 : ::ad::rss::world::LaneSegmentType invalidInitializedMember(static_cast<::ad::rss::world::LaneSegmentType>(-1)); 115 : 1 : value.type = invalidInitializedMember; 116 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 117 : : } 118 : : 119 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeDrivingDirectionTooSmall) 120 : : { 121 : 1 : ::ad::rss::world::LaneSegment value; 122 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 123 : 1 : value.id = valueId; 124 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 125 : 1 : value.type = valueType; 126 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 127 : 1 : value.drivingDirection = valueDrivingDirection; 128 : 1 : ::ad::physics::MetricRange valueLength; 129 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 130 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 131 : 1 : valueLength.minimum = valueLengthMinimum; 132 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 133 : 1 : valueLength.maximum = valueLengthMaximum; 134 : 1 : valueLength.maximum = valueLength.minimum; 135 : 1 : valueLength.minimum = valueLength.maximum; 136 : 1 : value.length = valueLength; 137 : 1 : ::ad::physics::MetricRange valueWidth; 138 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 139 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 140 : 1 : valueWidth.minimum = valueWidthMinimum; 141 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 142 : 1 : valueWidth.maximum = valueWidthMaximum; 143 : 1 : valueWidth.maximum = valueWidth.minimum; 144 : 1 : valueWidth.minimum = valueWidth.maximum; 145 : 1 : value.width = valueWidth; 146 : : 147 : : // override member with data type value below input range minimum 148 : 1 : ::ad::rss::world::LaneDrivingDirection invalidInitializedMember( 149 : : static_cast<::ad::rss::world::LaneDrivingDirection>(-1)); 150 : 1 : value.drivingDirection = invalidInitializedMember; 151 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 152 : : } 153 : : 154 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeDrivingDirectionTooBig) 155 : : { 156 : 1 : ::ad::rss::world::LaneSegment value; 157 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 158 : 1 : value.id = valueId; 159 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 160 : 1 : value.type = valueType; 161 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 162 : 1 : value.drivingDirection = valueDrivingDirection; 163 : 1 : ::ad::physics::MetricRange valueLength; 164 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 165 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 166 : 1 : valueLength.minimum = valueLengthMinimum; 167 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 168 : 1 : valueLength.maximum = valueLengthMaximum; 169 : 1 : valueLength.maximum = valueLength.minimum; 170 : 1 : valueLength.minimum = valueLength.maximum; 171 : 1 : value.length = valueLength; 172 : 1 : ::ad::physics::MetricRange valueWidth; 173 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 174 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 175 : 1 : valueWidth.minimum = valueWidthMinimum; 176 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 177 : 1 : valueWidth.maximum = valueWidthMaximum; 178 : 1 : valueWidth.maximum = valueWidth.minimum; 179 : 1 : valueWidth.minimum = valueWidth.maximum; 180 : 1 : value.width = valueWidth; 181 : : 182 : : // override member with data type value above input range maximum 183 : 1 : ::ad::rss::world::LaneDrivingDirection invalidInitializedMember( 184 : : static_cast<::ad::rss::world::LaneDrivingDirection>(-1)); 185 : 1 : value.drivingDirection = invalidInitializedMember; 186 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 187 : : } 188 : : 189 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeLengthTooSmall) 190 : : { 191 : 1 : ::ad::rss::world::LaneSegment value; 192 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 193 : 1 : value.id = valueId; 194 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 195 : 1 : value.type = valueType; 196 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 197 : 1 : value.drivingDirection = valueDrivingDirection; 198 : 1 : ::ad::physics::MetricRange valueLength; 199 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 200 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 201 : 1 : valueLength.minimum = valueLengthMinimum; 202 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 203 : 1 : valueLength.maximum = valueLengthMaximum; 204 : 1 : valueLength.maximum = valueLength.minimum; 205 : 1 : valueLength.minimum = valueLength.maximum; 206 : 1 : value.length = valueLength; 207 : 1 : ::ad::physics::MetricRange valueWidth; 208 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 209 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 210 : 1 : valueWidth.minimum = valueWidthMinimum; 211 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 212 : 1 : valueWidth.maximum = valueWidthMaximum; 213 : 1 : valueWidth.maximum = valueWidth.minimum; 214 : 1 : valueWidth.minimum = valueWidth.maximum; 215 : 1 : value.width = valueWidth; 216 : : 217 : : // override member with data type value below input range minimum 218 : 1 : ::ad::physics::MetricRange invalidInitializedMember; 219 : 1 : ::ad::physics::Distance invalidInitializedMemberMinimum(-1e9 * 1.1); 220 : 1 : invalidInitializedMember.minimum = invalidInitializedMemberMinimum; 221 : 1 : value.length = invalidInitializedMember; 222 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 223 : : } 224 : : 225 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeLengthTooBig) 226 : : { 227 : 1 : ::ad::rss::world::LaneSegment value; 228 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 229 : 1 : value.id = valueId; 230 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 231 : 1 : value.type = valueType; 232 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 233 : 1 : value.drivingDirection = valueDrivingDirection; 234 : 1 : ::ad::physics::MetricRange valueLength; 235 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 236 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 237 : 1 : valueLength.minimum = valueLengthMinimum; 238 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 239 : 1 : valueLength.maximum = valueLengthMaximum; 240 : 1 : valueLength.maximum = valueLength.minimum; 241 : 1 : valueLength.minimum = valueLength.maximum; 242 : 1 : value.length = valueLength; 243 : 1 : ::ad::physics::MetricRange valueWidth; 244 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 245 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 246 : 1 : valueWidth.minimum = valueWidthMinimum; 247 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 248 : 1 : valueWidth.maximum = valueWidthMaximum; 249 : 1 : valueWidth.maximum = valueWidth.minimum; 250 : 1 : valueWidth.minimum = valueWidth.maximum; 251 : 1 : value.width = valueWidth; 252 : : 253 : : // override member with data type value above input range maximum 254 : 1 : ::ad::physics::MetricRange invalidInitializedMember; 255 : 1 : ::ad::physics::Distance invalidInitializedMemberMinimum(1e9 * 1.1); 256 : 1 : invalidInitializedMember.minimum = invalidInitializedMemberMinimum; 257 : 1 : value.length = invalidInitializedMember; 258 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 259 : : } 260 : : 261 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeWidthTooSmall) 262 : : { 263 : 1 : ::ad::rss::world::LaneSegment value; 264 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 265 : 1 : value.id = valueId; 266 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 267 : 1 : value.type = valueType; 268 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 269 : 1 : value.drivingDirection = valueDrivingDirection; 270 : 1 : ::ad::physics::MetricRange valueLength; 271 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 272 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 273 : 1 : valueLength.minimum = valueLengthMinimum; 274 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 275 : 1 : valueLength.maximum = valueLengthMaximum; 276 : 1 : valueLength.maximum = valueLength.minimum; 277 : 1 : valueLength.minimum = valueLength.maximum; 278 : 1 : value.length = valueLength; 279 : 1 : ::ad::physics::MetricRange valueWidth; 280 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 281 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 282 : 1 : valueWidth.minimum = valueWidthMinimum; 283 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 284 : 1 : valueWidth.maximum = valueWidthMaximum; 285 : 1 : valueWidth.maximum = valueWidth.minimum; 286 : 1 : valueWidth.minimum = valueWidth.maximum; 287 : 1 : value.width = valueWidth; 288 : : 289 : : // override member with data type value below input range minimum 290 : 1 : ::ad::physics::MetricRange invalidInitializedMember; 291 : 1 : ::ad::physics::Distance invalidInitializedMemberMinimum(-1e9 * 1.1); 292 : 1 : invalidInitializedMember.minimum = invalidInitializedMemberMinimum; 293 : 1 : value.width = invalidInitializedMember; 294 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 295 : : } 296 : : 297 : 2 : TEST(LaneSegmentValidInputRangeTests, testValidInputRangeWidthTooBig) 298 : : { 299 : 1 : ::ad::rss::world::LaneSegment value; 300 : 1 : ::ad::rss::world::LaneSegmentId valueId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest()); 301 : 1 : value.id = valueId; 302 : 1 : ::ad::rss::world::LaneSegmentType valueType(::ad::rss::world::LaneSegmentType::Normal); 303 : 1 : value.type = valueType; 304 : 1 : ::ad::rss::world::LaneDrivingDirection valueDrivingDirection(::ad::rss::world::LaneDrivingDirection::Bidirectional); 305 : 1 : value.drivingDirection = valueDrivingDirection; 306 : 1 : ::ad::physics::MetricRange valueLength; 307 : 1 : ::ad::physics::Distance valueLengthMinimum(-1e9); 308 : 1 : valueLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 309 : 1 : valueLength.minimum = valueLengthMinimum; 310 : 1 : ::ad::physics::Distance valueLengthMaximum(-1e9); 311 : 1 : valueLength.maximum = valueLengthMaximum; 312 : 1 : valueLength.maximum = valueLength.minimum; 313 : 1 : valueLength.minimum = valueLength.maximum; 314 : 1 : value.length = valueLength; 315 : 1 : ::ad::physics::MetricRange valueWidth; 316 : 1 : ::ad::physics::Distance valueWidthMinimum(-1e9); 317 : 1 : valueWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct 318 : 1 : valueWidth.minimum = valueWidthMinimum; 319 : 1 : ::ad::physics::Distance valueWidthMaximum(-1e9); 320 : 1 : valueWidth.maximum = valueWidthMaximum; 321 : 1 : valueWidth.maximum = valueWidth.minimum; 322 : 1 : valueWidth.minimum = valueWidth.maximum; 323 : 1 : value.width = valueWidth; 324 : : 325 : : // override member with data type value above input range maximum 326 : 1 : ::ad::physics::MetricRange invalidInitializedMember; 327 : 1 : ::ad::physics::Distance invalidInitializedMemberMinimum(1e9 * 1.1); 328 : 1 : invalidInitializedMember.minimum = invalidInitializedMemberMinimum; 329 : 1 : value.width = invalidInitializedMember; 330 [ + - - + : 1 : ASSERT_FALSE(withinValidInputRange(value)); - - - - - - - - ] 331 : : }