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/MapMatchedPosition.hpp" 23 : : 24 : : class MapMatchedPositionTests : public testing::Test 25 : : { 26 : : protected: 27 : 12 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 12 : ::ad::map::match::MapMatchedPosition value; 31 : 12 : ::ad::map::match::LanePoint valueLanePoint; 32 : 12 : ::ad::map::point::ParaPoint valueLanePointParaPoint; 33 : 12 : ::ad::map::lane::LaneId valueLanePointParaPointLaneId(1); 34 : 12 : valueLanePointParaPoint.laneId = valueLanePointParaPointLaneId; 35 : 12 : ::ad::physics::ParametricValue valueLanePointParaPointParametricOffset(0.); 36 : 12 : valueLanePointParaPoint.parametricOffset = valueLanePointParaPointParametricOffset; 37 : 12 : valueLanePoint.paraPoint = valueLanePointParaPoint; 38 : 12 : ::ad::physics::RatioValue valueLanePointLateralT(std::numeric_limits<::ad::physics::RatioValue>::lowest()); 39 : 12 : valueLanePoint.lateralT = valueLanePointLateralT; 40 : 12 : ::ad::physics::Distance valueLanePointLaneLength(-1e9); 41 : 12 : valueLanePoint.laneLength = valueLanePointLaneLength; 42 : 12 : ::ad::physics::Distance valueLanePointLaneWidth(-1e9); 43 : 12 : valueLanePoint.laneWidth = valueLanePointLaneWidth; 44 : 12 : value.lanePoint = valueLanePoint; 45 : 12 : ::ad::map::match::MapMatchedPositionType valueType(::ad::map::match::MapMatchedPositionType::INVALID); 46 : 12 : value.type = valueType; 47 : 12 : ::ad::map::point::ECEFPoint valueMatchedPoint; 48 : 12 : ::ad::map::point::ECEFCoordinate valueMatchedPointX(-6400000); 49 : 12 : valueMatchedPoint.x = valueMatchedPointX; 50 : 12 : ::ad::map::point::ECEFCoordinate valueMatchedPointY(-6400000); 51 : 12 : valueMatchedPoint.y = valueMatchedPointY; 52 : 12 : ::ad::map::point::ECEFCoordinate valueMatchedPointZ(-6400000); 53 : 12 : valueMatchedPoint.z = valueMatchedPointZ; 54 : 12 : value.matchedPoint = valueMatchedPoint; 55 : 12 : ::ad::physics::Probability valueProbability(0.); 56 : 12 : value.probability = valueProbability; 57 : 12 : ::ad::map::point::ECEFPoint valueQueryPoint; 58 : 12 : ::ad::map::point::ECEFCoordinate valueQueryPointX(-6400000); 59 : 12 : valueQueryPoint.x = valueQueryPointX; 60 : 12 : ::ad::map::point::ECEFCoordinate valueQueryPointY(-6400000); 61 : 12 : valueQueryPoint.y = valueQueryPointY; 62 : 12 : ::ad::map::point::ECEFCoordinate valueQueryPointZ(-6400000); 63 : 12 : valueQueryPoint.z = valueQueryPointZ; 64 : 12 : value.queryPoint = valueQueryPoint; 65 : 12 : ::ad::physics::Distance valueMatchedPointDistance(-1e9); 66 : 12 : value.matchedPointDistance = valueMatchedPointDistance; 67 : 12 : mValue = value; 68 : 12 : } 69 : : 70 : : ::ad::map::match::MapMatchedPosition mValue; 71 : : }; 72 : : 73 : 2 : TEST_F(MapMatchedPositionTests, copyConstruction) 74 : : { 75 : 1 : ::ad::map::match::MapMatchedPosition value(mValue); 76 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 77 : 1 : } 78 : : 79 : 2 : TEST_F(MapMatchedPositionTests, moveConstruction) 80 : : { 81 : 1 : ::ad::map::match::MapMatchedPosition tmpValue(mValue); 82 : 1 : ::ad::map::match::MapMatchedPosition value(std::move(tmpValue)); 83 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 84 : 1 : } 85 : : 86 : 2 : TEST_F(MapMatchedPositionTests, copyAssignment) 87 : : { 88 : 1 : ::ad::map::match::MapMatchedPosition value; 89 : 1 : value = mValue; 90 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 91 : 1 : } 92 : : 93 : 2 : TEST_F(MapMatchedPositionTests, moveAssignment) 94 : : { 95 : 1 : ::ad::map::match::MapMatchedPosition tmpValue(mValue); 96 : 1 : ::ad::map::match::MapMatchedPosition value; 97 : 1 : value = std::move(tmpValue); 98 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 99 : 1 : } 100 : : 101 : 2 : TEST_F(MapMatchedPositionTests, comparisonOperatorEqual) 102 : : { 103 : 1 : ::ad::map::match::MapMatchedPosition valueA = mValue; 104 : 1 : ::ad::map::match::MapMatchedPosition valueB = mValue; 105 : : 106 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 107 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 108 : 1 : } 109 : : 110 : 2 : TEST_F(MapMatchedPositionTests, stringConversionTest) 111 : : { 112 [ + - ]: 1 : std::stringstream stream; 113 [ + - ]: 1 : stream << mValue; 114 [ + - ]: 1 : std::string ostreamStr = stream.str(); 115 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 116 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - ] 117 : : } 118 : : 119 : 2 : TEST_F(MapMatchedPositionTests, comparisonOperatorLanePointDiffers) 120 : : { 121 : 1 : ::ad::map::match::MapMatchedPosition valueA = mValue; 122 : 1 : ::ad::map::match::LanePoint lanePoint; 123 : 1 : ::ad::map::point::ParaPoint lanePointParaPoint; 124 : 1 : ::ad::map::lane::LaneId lanePointParaPointLaneId(std::numeric_limits<::ad::map::lane::LaneId>::max()); 125 : 1 : lanePointParaPoint.laneId = lanePointParaPointLaneId; 126 : 1 : ::ad::physics::ParametricValue lanePointParaPointParametricOffset(1.); 127 : 1 : lanePointParaPoint.parametricOffset = lanePointParaPointParametricOffset; 128 : 1 : lanePoint.paraPoint = lanePointParaPoint; 129 : 1 : ::ad::physics::RatioValue lanePointLateralT(std::numeric_limits<::ad::physics::RatioValue>::max()); 130 : 1 : lanePoint.lateralT = lanePointLateralT; 131 : 1 : ::ad::physics::Distance lanePointLaneLength(1e9); 132 : 1 : lanePoint.laneLength = lanePointLaneLength; 133 : 1 : ::ad::physics::Distance lanePointLaneWidth(1e9); 134 : 1 : lanePoint.laneWidth = lanePointLaneWidth; 135 : 1 : valueA.lanePoint = lanePoint; 136 : 1 : ::ad::map::match::MapMatchedPosition valueB = mValue; 137 : : 138 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 139 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 140 : 1 : } 141 : : 142 : 2 : TEST_F(MapMatchedPositionTests, comparisonOperatorTypeDiffers) 143 : : { 144 : 1 : ::ad::map::match::MapMatchedPosition valueA = mValue; 145 : 1 : ::ad::map::match::MapMatchedPositionType type(::ad::map::match::MapMatchedPositionType::LANE_RIGHT); 146 : 1 : valueA.type = type; 147 : 1 : ::ad::map::match::MapMatchedPosition valueB = mValue; 148 : : 149 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 150 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 151 : 1 : } 152 : : 153 : 2 : TEST_F(MapMatchedPositionTests, comparisonOperatorMatchedPointDiffers) 154 : : { 155 : 1 : ::ad::map::match::MapMatchedPosition valueA = mValue; 156 : 1 : ::ad::map::point::ECEFPoint matchedPoint; 157 : 1 : ::ad::map::point::ECEFCoordinate matchedPointX(6400000); 158 : 1 : matchedPoint.x = matchedPointX; 159 : 1 : ::ad::map::point::ECEFCoordinate matchedPointY(6400000); 160 : 1 : matchedPoint.y = matchedPointY; 161 : 1 : ::ad::map::point::ECEFCoordinate matchedPointZ(6400000); 162 : 1 : matchedPoint.z = matchedPointZ; 163 : 1 : valueA.matchedPoint = matchedPoint; 164 : 1 : ::ad::map::match::MapMatchedPosition valueB = mValue; 165 : : 166 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 167 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 168 : 1 : } 169 : : 170 : 2 : TEST_F(MapMatchedPositionTests, comparisonOperatorProbabilityDiffers) 171 : : { 172 : 1 : ::ad::map::match::MapMatchedPosition valueA = mValue; 173 : 1 : ::ad::physics::Probability probability(1.); 174 : 1 : valueA.probability = probability; 175 : 1 : ::ad::map::match::MapMatchedPosition valueB = mValue; 176 : : 177 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 178 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 179 : 1 : } 180 : : 181 : 2 : TEST_F(MapMatchedPositionTests, comparisonOperatorQueryPointDiffers) 182 : : { 183 : 1 : ::ad::map::match::MapMatchedPosition valueA = mValue; 184 : 1 : ::ad::map::point::ECEFPoint queryPoint; 185 : 1 : ::ad::map::point::ECEFCoordinate queryPointX(6400000); 186 : 1 : queryPoint.x = queryPointX; 187 : 1 : ::ad::map::point::ECEFCoordinate queryPointY(6400000); 188 : 1 : queryPoint.y = queryPointY; 189 : 1 : ::ad::map::point::ECEFCoordinate queryPointZ(6400000); 190 : 1 : queryPoint.z = queryPointZ; 191 : 1 : valueA.queryPoint = queryPoint; 192 : 1 : ::ad::map::match::MapMatchedPosition valueB = mValue; 193 : : 194 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 195 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 196 : 1 : } 197 : : 198 : 2 : TEST_F(MapMatchedPositionTests, comparisonOperatorMatchedPointDistanceDiffers) 199 : : { 200 : 1 : ::ad::map::match::MapMatchedPosition valueA = mValue; 201 : 1 : ::ad::physics::Distance matchedPointDistance(1e9); 202 : 1 : valueA.matchedPointDistance = matchedPointDistance; 203 : 1 : ::ad::map::match::MapMatchedPosition valueB = mValue; 204 : : 205 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 206 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 207 : 1 : } 208 : : 209 : : #if defined(__clang__) && (__clang_major__ >= 7) 210 : : #pragma GCC diagnostic pop 211 : : #endif