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/ENUObjectPosition.hpp" 23 : : 24 : : class ENUObjectPositionTests : public testing::Test 25 : : { 26 : : protected: 27 : 10 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 10 : ::ad::map::match::ENUObjectPosition value; 31 : 10 : ::ad::map::point::ENUPoint valueCenterPoint; 32 : 10 : ::ad::map::point::ENUCoordinate valueCenterPointX(-16384); 33 : 10 : valueCenterPoint.x = valueCenterPointX; 34 : 10 : ::ad::map::point::ENUCoordinate valueCenterPointY(-16384); 35 : 10 : valueCenterPoint.y = valueCenterPointY; 36 : 10 : ::ad::map::point::ENUCoordinate valueCenterPointZ(-16384); 37 : 10 : valueCenterPoint.z = valueCenterPointZ; 38 : 10 : value.centerPoint = valueCenterPoint; 39 : 10 : ::ad::map::point::ENUHeading valueHeading(-3.141592655); 40 : 10 : value.heading = valueHeading; 41 : 10 : ::ad::map::point::GeoPoint valueEnuReferencePoint; 42 : 10 : ::ad::map::point::Longitude valueEnuReferencePointLongitude(-180); 43 : 10 : valueEnuReferencePoint.longitude = valueEnuReferencePointLongitude; 44 : 10 : ::ad::map::point::Latitude valueEnuReferencePointLatitude(-90); 45 : 10 : valueEnuReferencePoint.latitude = valueEnuReferencePointLatitude; 46 : 10 : ::ad::map::point::Altitude valueEnuReferencePointAltitude(-11000); 47 : 10 : valueEnuReferencePoint.altitude = valueEnuReferencePointAltitude; 48 : 10 : value.enuReferencePoint = valueEnuReferencePoint; 49 : 10 : ::ad::physics::Dimension3D valueDimension; 50 : 10 : ::ad::physics::Distance valueDimensionLength(-1e9); 51 : 10 : valueDimension.length = valueDimensionLength; 52 : 10 : ::ad::physics::Distance valueDimensionWidth(-1e9); 53 : 10 : valueDimension.width = valueDimensionWidth; 54 : 10 : ::ad::physics::Distance valueDimensionHeight(-1e9); 55 : 10 : valueDimension.height = valueDimensionHeight; 56 : 10 : value.dimension = valueDimension; 57 : 10 : mValue = value; 58 : 10 : } 59 : : 60 : : ::ad::map::match::ENUObjectPosition mValue; 61 : : }; 62 : : 63 : 2 : TEST_F(ENUObjectPositionTests, copyConstruction) 64 : : { 65 : 1 : ::ad::map::match::ENUObjectPosition value(mValue); 66 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 67 : 1 : } 68 : : 69 : 2 : TEST_F(ENUObjectPositionTests, moveConstruction) 70 : : { 71 : 1 : ::ad::map::match::ENUObjectPosition tmpValue(mValue); 72 : 1 : ::ad::map::match::ENUObjectPosition value(std::move(tmpValue)); 73 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 74 : 1 : } 75 : : 76 : 2 : TEST_F(ENUObjectPositionTests, copyAssignment) 77 : : { 78 : 1 : ::ad::map::match::ENUObjectPosition value; 79 : 1 : value = mValue; 80 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 81 : 1 : } 82 : : 83 : 2 : TEST_F(ENUObjectPositionTests, moveAssignment) 84 : : { 85 : 1 : ::ad::map::match::ENUObjectPosition tmpValue(mValue); 86 : 1 : ::ad::map::match::ENUObjectPosition value; 87 : 1 : value = std::move(tmpValue); 88 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 89 : 1 : } 90 : : 91 : 2 : TEST_F(ENUObjectPositionTests, comparisonOperatorEqual) 92 : : { 93 : 1 : ::ad::map::match::ENUObjectPosition valueA = mValue; 94 : 1 : ::ad::map::match::ENUObjectPosition valueB = mValue; 95 : : 96 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 97 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 98 : 1 : } 99 : : 100 : 2 : TEST_F(ENUObjectPositionTests, stringConversionTest) 101 : : { 102 [ + - ]: 1 : std::stringstream stream; 103 [ + - ]: 1 : stream << mValue; 104 [ + - ]: 1 : std::string ostreamStr = stream.str(); 105 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 106 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - ] 107 : : } 108 : : 109 : 2 : TEST_F(ENUObjectPositionTests, comparisonOperatorCenterPointDiffers) 110 : : { 111 : 1 : ::ad::map::match::ENUObjectPosition valueA = mValue; 112 : 1 : ::ad::map::point::ENUPoint centerPoint; 113 : 1 : ::ad::map::point::ENUCoordinate centerPointX(16384); 114 : 1 : centerPoint.x = centerPointX; 115 : 1 : ::ad::map::point::ENUCoordinate centerPointY(16384); 116 : 1 : centerPoint.y = centerPointY; 117 : 1 : ::ad::map::point::ENUCoordinate centerPointZ(16384); 118 : 1 : centerPoint.z = centerPointZ; 119 : 1 : valueA.centerPoint = centerPoint; 120 : 1 : ::ad::map::match::ENUObjectPosition valueB = mValue; 121 : : 122 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 123 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 124 : 1 : } 125 : : 126 : 2 : TEST_F(ENUObjectPositionTests, comparisonOperatorHeadingDiffers) 127 : : { 128 : 1 : ::ad::map::match::ENUObjectPosition valueA = mValue; 129 : 1 : ::ad::map::point::ENUHeading heading(3.141592655); 130 : 1 : valueA.heading = heading; 131 : 1 : ::ad::map::match::ENUObjectPosition valueB = mValue; 132 : : 133 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 134 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 135 : 1 : } 136 : : 137 : 2 : TEST_F(ENUObjectPositionTests, comparisonOperatorEnuReferencePointDiffers) 138 : : { 139 : 1 : ::ad::map::match::ENUObjectPosition valueA = mValue; 140 : 1 : ::ad::map::point::GeoPoint enuReferencePoint; 141 : 1 : ::ad::map::point::Longitude enuReferencePointLongitude(180); 142 : 1 : enuReferencePoint.longitude = enuReferencePointLongitude; 143 : 1 : ::ad::map::point::Latitude enuReferencePointLatitude(90); 144 : 1 : enuReferencePoint.latitude = enuReferencePointLatitude; 145 : 1 : ::ad::map::point::Altitude enuReferencePointAltitude(9000); 146 : 1 : enuReferencePoint.altitude = enuReferencePointAltitude; 147 : 1 : valueA.enuReferencePoint = enuReferencePoint; 148 : 1 : ::ad::map::match::ENUObjectPosition valueB = mValue; 149 : : 150 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 151 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 152 : 1 : } 153 : : 154 : 2 : TEST_F(ENUObjectPositionTests, comparisonOperatorDimensionDiffers) 155 : : { 156 : 1 : ::ad::map::match::ENUObjectPosition valueA = mValue; 157 : 1 : ::ad::physics::Dimension3D dimension; 158 : 1 : ::ad::physics::Distance dimensionLength(1e9); 159 : 1 : dimension.length = dimensionLength; 160 : 1 : ::ad::physics::Distance dimensionWidth(1e9); 161 : 1 : dimension.width = dimensionWidth; 162 : 1 : ::ad::physics::Distance dimensionHeight(1e9); 163 : 1 : dimension.height = dimensionHeight; 164 : 1 : valueA.dimension = dimension; 165 : 1 : ::ad::map::match::ENUObjectPosition valueB = mValue; 166 : : 167 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 168 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 169 : 1 : } 170 : : 171 : : #if defined(__clang__) && (__clang_major__ >= 7) 172 : : #pragma GCC diagnostic pop 173 : : #endif