Branch data Line data Source code
1 : : /* 2 : : * ----------------- BEGIN LICENSE BLOCK --------------------------------- 3 : : * 4 : : * Copyright (C) 2018-2021 Intel Corporation 5 : : * 6 : : * SPDX-License-Identifier: MIT 7 : : * 8 : : * ----------------- END LICENSE BLOCK ----------------------------------- 9 : : */ 10 : : 11 : : /* 12 : : * Generated file 13 : : */ 14 : : 15 : : #if defined(__clang__) && (__clang_major__ >= 7) 16 : : #pragma GCC diagnostic push 17 : : #pragma GCC diagnostic ignored "-Wself-assign-overloaded" 18 : : #endif 19 : : 20 : : #include <gtest/gtest.h> 21 : : #include <limits> 22 : : #include "ad/map/match/MapMatchedObjectBoundingBox.hpp" 23 : : 24 : : class MapMatchedObjectBoundingBoxTests : public testing::Test 25 : : { 26 : : protected: 27 : 10 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 20 : ::ad::map::match::MapMatchedObjectBoundingBox value; 31 : 20 : ::ad::map::match::LaneOccupiedRegionList valueLaneOccupiedRegions; 32 : 10 : ::ad::map::match::LaneOccupiedRegion valueLaneOccupiedRegionsElement; 33 : 10 : ::ad::map::lane::LaneId valueLaneOccupiedRegionsElementLaneId(1); 34 : 10 : valueLaneOccupiedRegionsElement.laneId = valueLaneOccupiedRegionsElementLaneId; 35 : 10 : ::ad::physics::ParametricRange valueLaneOccupiedRegionsElementLongitudinalRange; 36 : 10 : ::ad::physics::ParametricValue valueLaneOccupiedRegionsElementLongitudinalRangeMinimum(0.); 37 : 10 : valueLaneOccupiedRegionsElementLongitudinalRange.minimum = valueLaneOccupiedRegionsElementLongitudinalRangeMinimum; 38 : 10 : ::ad::physics::ParametricValue valueLaneOccupiedRegionsElementLongitudinalRangeMaximum(0.); 39 : 10 : valueLaneOccupiedRegionsElementLongitudinalRange.maximum = valueLaneOccupiedRegionsElementLongitudinalRangeMaximum; 40 : 10 : valueLaneOccupiedRegionsElementLongitudinalRange.maximum = valueLaneOccupiedRegionsElementLongitudinalRange.minimum; 41 : 10 : valueLaneOccupiedRegionsElementLongitudinalRange.minimum = valueLaneOccupiedRegionsElementLongitudinalRange.maximum; 42 : 10 : valueLaneOccupiedRegionsElement.longitudinalRange = valueLaneOccupiedRegionsElementLongitudinalRange; 43 : 10 : ::ad::physics::ParametricRange valueLaneOccupiedRegionsElementLateralRange; 44 : 10 : ::ad::physics::ParametricValue valueLaneOccupiedRegionsElementLateralRangeMinimum(0.); 45 : 10 : valueLaneOccupiedRegionsElementLateralRange.minimum = valueLaneOccupiedRegionsElementLateralRangeMinimum; 46 : 10 : ::ad::physics::ParametricValue valueLaneOccupiedRegionsElementLateralRangeMaximum(0.); 47 : 10 : valueLaneOccupiedRegionsElementLateralRange.maximum = valueLaneOccupiedRegionsElementLateralRangeMaximum; 48 : 10 : valueLaneOccupiedRegionsElementLateralRange.maximum = valueLaneOccupiedRegionsElementLateralRange.minimum; 49 : 10 : valueLaneOccupiedRegionsElementLateralRange.minimum = valueLaneOccupiedRegionsElementLateralRange.maximum; 50 : 10 : valueLaneOccupiedRegionsElement.lateralRange = valueLaneOccupiedRegionsElementLateralRange; 51 [ + - ]: 10 : valueLaneOccupiedRegions.resize(1, valueLaneOccupiedRegionsElement); 52 [ + - ]: 10 : value.laneOccupiedRegions = valueLaneOccupiedRegions; 53 : 20 : ::ad::map::match::MapMatchedObjectReferencePositionList valueReferencePointPositions; 54 : 20 : ::ad::map::match::MapMatchedPositionConfidenceList valueReferencePointPositionsElement; 55 : 10 : ::ad::map::match::MapMatchedPosition valueReferencePointPositionsElementElement; 56 : 10 : ::ad::map::match::LanePoint valueReferencePointPositionsElementElementLanePoint; 57 : 10 : ::ad::map::point::ParaPoint valueReferencePointPositionsElementElementLanePointParaPoint; 58 : 10 : ::ad::map::lane::LaneId valueReferencePointPositionsElementElementLanePointParaPointLaneId(1); 59 : : valueReferencePointPositionsElementElementLanePointParaPoint.laneId 60 : 10 : = valueReferencePointPositionsElementElementLanePointParaPointLaneId; 61 : 10 : ::ad::physics::ParametricValue valueReferencePointPositionsElementElementLanePointParaPointParametricOffset(0.); 62 : : valueReferencePointPositionsElementElementLanePointParaPoint.parametricOffset 63 : 10 : = valueReferencePointPositionsElementElementLanePointParaPointParametricOffset; 64 : : valueReferencePointPositionsElementElementLanePoint.paraPoint 65 : 10 : = valueReferencePointPositionsElementElementLanePointParaPoint; 66 : : ::ad::physics::RatioValue valueReferencePointPositionsElementElementLanePointLateralT( 67 : 10 : std::numeric_limits<::ad::physics::RatioValue>::lowest()); 68 : : valueReferencePointPositionsElementElementLanePoint.lateralT 69 : 10 : = valueReferencePointPositionsElementElementLanePointLateralT; 70 : 10 : ::ad::physics::Distance valueReferencePointPositionsElementElementLanePointLaneLength(-1e9); 71 : : valueReferencePointPositionsElementElementLanePoint.laneLength 72 : 10 : = valueReferencePointPositionsElementElementLanePointLaneLength; 73 : 10 : ::ad::physics::Distance valueReferencePointPositionsElementElementLanePointLaneWidth(-1e9); 74 : : valueReferencePointPositionsElementElementLanePoint.laneWidth 75 : 10 : = valueReferencePointPositionsElementElementLanePointLaneWidth; 76 : 10 : valueReferencePointPositionsElementElement.lanePoint = valueReferencePointPositionsElementElementLanePoint; 77 : 10 : ::ad::map::match::MapMatchedPositionType valueReferencePointPositionsElementElementType( 78 : : ::ad::map::match::MapMatchedPositionType::INVALID); 79 : 10 : valueReferencePointPositionsElementElement.type = valueReferencePointPositionsElementElementType; 80 : 10 : ::ad::map::point::ECEFPoint valueReferencePointPositionsElementElementMatchedPoint; 81 : 10 : ::ad::map::point::ECEFCoordinate valueReferencePointPositionsElementElementMatchedPointX(-6400000); 82 : 10 : valueReferencePointPositionsElementElementMatchedPoint.x = valueReferencePointPositionsElementElementMatchedPointX; 83 : 10 : ::ad::map::point::ECEFCoordinate valueReferencePointPositionsElementElementMatchedPointY(-6400000); 84 : 10 : valueReferencePointPositionsElementElementMatchedPoint.y = valueReferencePointPositionsElementElementMatchedPointY; 85 : 10 : ::ad::map::point::ECEFCoordinate valueReferencePointPositionsElementElementMatchedPointZ(-6400000); 86 : 10 : valueReferencePointPositionsElementElementMatchedPoint.z = valueReferencePointPositionsElementElementMatchedPointZ; 87 : 10 : valueReferencePointPositionsElementElement.matchedPoint = valueReferencePointPositionsElementElementMatchedPoint; 88 : 10 : ::ad::physics::Probability valueReferencePointPositionsElementElementProbability(0.); 89 : 10 : valueReferencePointPositionsElementElement.probability = valueReferencePointPositionsElementElementProbability; 90 : 10 : ::ad::map::point::ECEFPoint valueReferencePointPositionsElementElementQueryPoint; 91 : 10 : ::ad::map::point::ECEFCoordinate valueReferencePointPositionsElementElementQueryPointX(-6400000); 92 : 10 : valueReferencePointPositionsElementElementQueryPoint.x = valueReferencePointPositionsElementElementQueryPointX; 93 : 10 : ::ad::map::point::ECEFCoordinate valueReferencePointPositionsElementElementQueryPointY(-6400000); 94 : 10 : valueReferencePointPositionsElementElementQueryPoint.y = valueReferencePointPositionsElementElementQueryPointY; 95 : 10 : ::ad::map::point::ECEFCoordinate valueReferencePointPositionsElementElementQueryPointZ(-6400000); 96 : 10 : valueReferencePointPositionsElementElementQueryPoint.z = valueReferencePointPositionsElementElementQueryPointZ; 97 : 10 : valueReferencePointPositionsElementElement.queryPoint = valueReferencePointPositionsElementElementQueryPoint; 98 : 10 : ::ad::physics::Distance valueReferencePointPositionsElementElementMatchedPointDistance(-1e9); 99 : : valueReferencePointPositionsElementElement.matchedPointDistance 100 : 10 : = valueReferencePointPositionsElementElementMatchedPointDistance; 101 [ + - ]: 10 : valueReferencePointPositionsElement.resize(1, valueReferencePointPositionsElementElement); 102 [ + - ]: 10 : valueReferencePointPositions.resize(1, valueReferencePointPositionsElement); 103 [ + - ]: 10 : value.referencePointPositions = valueReferencePointPositions; 104 : 10 : ::ad::physics::Distance valueSamplingDistance(-1e9); 105 : 10 : value.samplingDistance = valueSamplingDistance; 106 : 10 : ::ad::physics::Distance valueMatchRadius(-1e9); 107 : 10 : value.matchRadius = valueMatchRadius; 108 [ + - ]: 10 : mValue = value; 109 : 10 : } 110 : : 111 : : ::ad::map::match::MapMatchedObjectBoundingBox mValue; 112 : : }; 113 : : 114 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, copyConstruction) 115 : : { 116 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox value(mValue); 117 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 118 : 1 : } 119 : : 120 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, moveConstruction) 121 : : { 122 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox tmpValue(mValue); 123 : 2 : ::ad::map::match::MapMatchedObjectBoundingBox value(std::move(tmpValue)); 124 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 125 : 1 : } 126 : : 127 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, copyAssignment) 128 : : { 129 : 2 : ::ad::map::match::MapMatchedObjectBoundingBox value; 130 [ + - ]: 1 : value = mValue; 131 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 132 : 1 : } 133 : : 134 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, moveAssignment) 135 : : { 136 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox tmpValue(mValue); 137 : 2 : ::ad::map::match::MapMatchedObjectBoundingBox value; 138 : 1 : value = std::move(tmpValue); 139 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 140 : 1 : } 141 : : 142 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, comparisonOperatorEqual) 143 : : { 144 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueA = mValue; 145 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueB = mValue; 146 : : 147 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 148 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 149 : 1 : } 150 : : 151 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, stringConversionTest) 152 : : { 153 [ + - ]: 1 : std::stringstream stream; 154 [ + - ]: 1 : stream << mValue; 155 [ + - ]: 1 : std::string ostreamStr = stream.str(); 156 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 157 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - ] 158 : : } 159 : : 160 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, comparisonOperatorLaneOccupiedRegionsDiffers) 161 : : { 162 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueA = mValue; 163 : 2 : ::ad::map::match::LaneOccupiedRegionList laneOccupiedRegions; 164 : 1 : ::ad::map::match::LaneOccupiedRegion laneOccupiedRegionsElement; 165 : 1 : ::ad::map::lane::LaneId laneOccupiedRegionsElementLaneId(std::numeric_limits<::ad::map::lane::LaneId>::max()); 166 : 1 : laneOccupiedRegionsElement.laneId = laneOccupiedRegionsElementLaneId; 167 : 1 : ::ad::physics::ParametricRange laneOccupiedRegionsElementLongitudinalRange; 168 : 1 : ::ad::physics::ParametricValue laneOccupiedRegionsElementLongitudinalRangeMinimum(1.); 169 : 1 : laneOccupiedRegionsElementLongitudinalRange.minimum = laneOccupiedRegionsElementLongitudinalRangeMinimum; 170 : 1 : ::ad::physics::ParametricValue laneOccupiedRegionsElementLongitudinalRangeMaximum(1.); 171 : 1 : laneOccupiedRegionsElementLongitudinalRange.maximum = laneOccupiedRegionsElementLongitudinalRangeMaximum; 172 : 1 : laneOccupiedRegionsElementLongitudinalRange.maximum = laneOccupiedRegionsElementLongitudinalRange.minimum; 173 : 1 : laneOccupiedRegionsElementLongitudinalRange.minimum = laneOccupiedRegionsElementLongitudinalRange.maximum; 174 : 1 : laneOccupiedRegionsElement.longitudinalRange = laneOccupiedRegionsElementLongitudinalRange; 175 : 1 : ::ad::physics::ParametricRange laneOccupiedRegionsElementLateralRange; 176 : 1 : ::ad::physics::ParametricValue laneOccupiedRegionsElementLateralRangeMinimum(1.); 177 : 1 : laneOccupiedRegionsElementLateralRange.minimum = laneOccupiedRegionsElementLateralRangeMinimum; 178 : 1 : ::ad::physics::ParametricValue laneOccupiedRegionsElementLateralRangeMaximum(1.); 179 : 1 : laneOccupiedRegionsElementLateralRange.maximum = laneOccupiedRegionsElementLateralRangeMaximum; 180 : 1 : laneOccupiedRegionsElementLateralRange.maximum = laneOccupiedRegionsElementLateralRange.minimum; 181 : 1 : laneOccupiedRegionsElementLateralRange.minimum = laneOccupiedRegionsElementLateralRange.maximum; 182 : 1 : laneOccupiedRegionsElement.lateralRange = laneOccupiedRegionsElementLateralRange; 183 [ + - ]: 1 : laneOccupiedRegions.resize(2, laneOccupiedRegionsElement); 184 [ + - ]: 1 : valueA.laneOccupiedRegions = laneOccupiedRegions; 185 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueB = mValue; 186 : : 187 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 188 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 189 : 1 : } 190 : : 191 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, comparisonOperatorReferencePointPositionsDiffers) 192 : : { 193 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueA = mValue; 194 : 2 : ::ad::map::match::MapMatchedObjectReferencePositionList referencePointPositions; 195 : 2 : ::ad::map::match::MapMatchedPositionConfidenceList referencePointPositionsElement; 196 : 1 : ::ad::map::match::MapMatchedPosition referencePointPositionsElementElement; 197 : 1 : ::ad::map::match::LanePoint referencePointPositionsElementElementLanePoint; 198 : 1 : ::ad::map::point::ParaPoint referencePointPositionsElementElementLanePointParaPoint; 199 : : ::ad::map::lane::LaneId referencePointPositionsElementElementLanePointParaPointLaneId( 200 : 1 : std::numeric_limits<::ad::map::lane::LaneId>::max()); 201 : : referencePointPositionsElementElementLanePointParaPoint.laneId 202 : 1 : = referencePointPositionsElementElementLanePointParaPointLaneId; 203 : 1 : ::ad::physics::ParametricValue referencePointPositionsElementElementLanePointParaPointParametricOffset(1.); 204 : : referencePointPositionsElementElementLanePointParaPoint.parametricOffset 205 : 1 : = referencePointPositionsElementElementLanePointParaPointParametricOffset; 206 : 1 : referencePointPositionsElementElementLanePoint.paraPoint = referencePointPositionsElementElementLanePointParaPoint; 207 : : ::ad::physics::RatioValue referencePointPositionsElementElementLanePointLateralT( 208 : 1 : std::numeric_limits<::ad::physics::RatioValue>::max()); 209 : 1 : referencePointPositionsElementElementLanePoint.lateralT = referencePointPositionsElementElementLanePointLateralT; 210 : 1 : ::ad::physics::Distance referencePointPositionsElementElementLanePointLaneLength(1e9); 211 : 1 : referencePointPositionsElementElementLanePoint.laneLength = referencePointPositionsElementElementLanePointLaneLength; 212 : 1 : ::ad::physics::Distance referencePointPositionsElementElementLanePointLaneWidth(1e9); 213 : 1 : referencePointPositionsElementElementLanePoint.laneWidth = referencePointPositionsElementElementLanePointLaneWidth; 214 : 1 : referencePointPositionsElementElement.lanePoint = referencePointPositionsElementElementLanePoint; 215 : 1 : ::ad::map::match::MapMatchedPositionType referencePointPositionsElementElementType( 216 : : ::ad::map::match::MapMatchedPositionType::LANE_RIGHT); 217 : 1 : referencePointPositionsElementElement.type = referencePointPositionsElementElementType; 218 : 1 : ::ad::map::point::ECEFPoint referencePointPositionsElementElementMatchedPoint; 219 : 1 : ::ad::map::point::ECEFCoordinate referencePointPositionsElementElementMatchedPointX(6400000); 220 : 1 : referencePointPositionsElementElementMatchedPoint.x = referencePointPositionsElementElementMatchedPointX; 221 : 1 : ::ad::map::point::ECEFCoordinate referencePointPositionsElementElementMatchedPointY(6400000); 222 : 1 : referencePointPositionsElementElementMatchedPoint.y = referencePointPositionsElementElementMatchedPointY; 223 : 1 : ::ad::map::point::ECEFCoordinate referencePointPositionsElementElementMatchedPointZ(6400000); 224 : 1 : referencePointPositionsElementElementMatchedPoint.z = referencePointPositionsElementElementMatchedPointZ; 225 : 1 : referencePointPositionsElementElement.matchedPoint = referencePointPositionsElementElementMatchedPoint; 226 : 1 : ::ad::physics::Probability referencePointPositionsElementElementProbability(1.); 227 : 1 : referencePointPositionsElementElement.probability = referencePointPositionsElementElementProbability; 228 : 1 : ::ad::map::point::ECEFPoint referencePointPositionsElementElementQueryPoint; 229 : 1 : ::ad::map::point::ECEFCoordinate referencePointPositionsElementElementQueryPointX(6400000); 230 : 1 : referencePointPositionsElementElementQueryPoint.x = referencePointPositionsElementElementQueryPointX; 231 : 1 : ::ad::map::point::ECEFCoordinate referencePointPositionsElementElementQueryPointY(6400000); 232 : 1 : referencePointPositionsElementElementQueryPoint.y = referencePointPositionsElementElementQueryPointY; 233 : 1 : ::ad::map::point::ECEFCoordinate referencePointPositionsElementElementQueryPointZ(6400000); 234 : 1 : referencePointPositionsElementElementQueryPoint.z = referencePointPositionsElementElementQueryPointZ; 235 : 1 : referencePointPositionsElementElement.queryPoint = referencePointPositionsElementElementQueryPoint; 236 : 1 : ::ad::physics::Distance referencePointPositionsElementElementMatchedPointDistance(1e9); 237 : : referencePointPositionsElementElement.matchedPointDistance 238 : 1 : = referencePointPositionsElementElementMatchedPointDistance; 239 [ + - ]: 1 : referencePointPositionsElement.resize(2, referencePointPositionsElementElement); 240 [ + - ]: 1 : referencePointPositions.resize(2, referencePointPositionsElement); 241 [ + - ]: 1 : valueA.referencePointPositions = referencePointPositions; 242 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueB = mValue; 243 : : 244 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 245 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 246 : 1 : } 247 : : 248 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, comparisonOperatorSamplingDistanceDiffers) 249 : : { 250 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueA = mValue; 251 : 1 : ::ad::physics::Distance samplingDistance(1e9); 252 : 1 : valueA.samplingDistance = samplingDistance; 253 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueB = mValue; 254 : : 255 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 256 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 257 : 1 : } 258 : : 259 : 2 : TEST_F(MapMatchedObjectBoundingBoxTests, comparisonOperatorMatchRadiusDiffers) 260 : : { 261 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueA = mValue; 262 : 1 : ::ad::physics::Distance matchRadius(1e9); 263 : 1 : valueA.matchRadius = matchRadius; 264 [ + - ]: 2 : ::ad::map::match::MapMatchedObjectBoundingBox valueB = mValue; 265 : : 266 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 267 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 268 : 1 : } 269 : : 270 : : #if defined(__clang__) && (__clang_major__ >= 7) 271 : : #pragma GCC diagnostic pop 272 : : #endif