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/lane/ContactLane.hpp" 23 : : 24 : : class ContactLaneTests : public testing::Test 25 : : { 26 : : protected: 27 : 11 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 22 : ::ad::map::lane::ContactLane value; 31 : 11 : ::ad::map::lane::LaneId valueToLane(1); 32 : 11 : value.toLane = valueToLane; 33 : 11 : ::ad::map::lane::ContactLocation valueLocation(::ad::map::lane::ContactLocation::INVALID); 34 : 11 : value.location = valueLocation; 35 : 22 : ::ad::map::lane::ContactTypeList valueTypes; 36 : 11 : ::ad::map::lane::ContactType valueTypesElement(::ad::map::lane::ContactType::INVALID); 37 [ + - ]: 11 : valueTypes.resize(1, valueTypesElement); 38 [ + - ]: 11 : value.types = valueTypes; 39 : 22 : ::ad::map::restriction::Restrictions valueRestrictions; 40 : 22 : ::ad::map::restriction::RestrictionList valueRestrictionsConjunctions; 41 : 22 : ::ad::map::restriction::Restriction valueRestrictionsConjunctionsElement; 42 : 11 : bool valueRestrictionsConjunctionsElementNegated{true}; 43 : 11 : valueRestrictionsConjunctionsElement.negated = valueRestrictionsConjunctionsElementNegated; 44 : 22 : ::ad::map::restriction::RoadUserTypeList valueRestrictionsConjunctionsElementRoadUserTypes; 45 : 11 : ::ad::map::restriction::RoadUserType valueRestrictionsConjunctionsElementRoadUserTypesElement( 46 : : ::ad::map::restriction::RoadUserType::INVALID); 47 [ + - ]: 11 : valueRestrictionsConjunctionsElementRoadUserTypes.resize(1, 48 : : valueRestrictionsConjunctionsElementRoadUserTypesElement); 49 [ + - ]: 11 : valueRestrictionsConjunctionsElement.roadUserTypes = valueRestrictionsConjunctionsElementRoadUserTypes; 50 : 11 : ::ad::map::restriction::PassengerCount valueRestrictionsConjunctionsElementPassengersMin( 51 : : std::numeric_limits<::ad::map::restriction::PassengerCount>::lowest()); 52 : 11 : valueRestrictionsConjunctionsElement.passengersMin = valueRestrictionsConjunctionsElementPassengersMin; 53 [ + - ]: 11 : valueRestrictionsConjunctions.resize(1, valueRestrictionsConjunctionsElement); 54 [ + - ]: 11 : valueRestrictions.conjunctions = valueRestrictionsConjunctions; 55 : 22 : ::ad::map::restriction::RestrictionList valueRestrictionsDisjunctions; 56 : 22 : ::ad::map::restriction::Restriction valueRestrictionsDisjunctionsElement; 57 : 11 : bool valueRestrictionsDisjunctionsElementNegated{true}; 58 : 11 : valueRestrictionsDisjunctionsElement.negated = valueRestrictionsDisjunctionsElementNegated; 59 : 22 : ::ad::map::restriction::RoadUserTypeList valueRestrictionsDisjunctionsElementRoadUserTypes; 60 : 11 : ::ad::map::restriction::RoadUserType valueRestrictionsDisjunctionsElementRoadUserTypesElement( 61 : : ::ad::map::restriction::RoadUserType::INVALID); 62 [ + - ]: 11 : valueRestrictionsDisjunctionsElementRoadUserTypes.resize(1, 63 : : valueRestrictionsDisjunctionsElementRoadUserTypesElement); 64 [ + - ]: 11 : valueRestrictionsDisjunctionsElement.roadUserTypes = valueRestrictionsDisjunctionsElementRoadUserTypes; 65 : 11 : ::ad::map::restriction::PassengerCount valueRestrictionsDisjunctionsElementPassengersMin( 66 : : std::numeric_limits<::ad::map::restriction::PassengerCount>::lowest()); 67 : 11 : valueRestrictionsDisjunctionsElement.passengersMin = valueRestrictionsDisjunctionsElementPassengersMin; 68 [ + - ]: 11 : valueRestrictionsDisjunctions.resize(1, valueRestrictionsDisjunctionsElement); 69 [ + - ]: 11 : valueRestrictions.disjunctions = valueRestrictionsDisjunctions; 70 [ + - ]: 11 : value.restrictions = valueRestrictions; 71 : 11 : ::ad::map::landmark::LandmarkId valueTrafficLightId(std::numeric_limits<::ad::map::landmark::LandmarkId>::lowest()); 72 : 11 : value.trafficLightId = valueTrafficLightId; 73 [ + - ]: 11 : mValue = value; 74 : 11 : } 75 : : 76 : : ::ad::map::lane::ContactLane mValue; 77 : : }; 78 : : 79 : 2 : TEST_F(ContactLaneTests, copyConstruction) 80 : : { 81 [ + - ]: 2 : ::ad::map::lane::ContactLane value(mValue); 82 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 83 : 1 : } 84 : : 85 : 2 : TEST_F(ContactLaneTests, moveConstruction) 86 : : { 87 [ + - ]: 2 : ::ad::map::lane::ContactLane tmpValue(mValue); 88 : 2 : ::ad::map::lane::ContactLane value(std::move(tmpValue)); 89 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 90 : 1 : } 91 : : 92 : 2 : TEST_F(ContactLaneTests, copyAssignment) 93 : : { 94 : 2 : ::ad::map::lane::ContactLane value; 95 [ + - ]: 1 : value = mValue; 96 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 97 : 1 : } 98 : : 99 : 2 : TEST_F(ContactLaneTests, moveAssignment) 100 : : { 101 [ + - ]: 2 : ::ad::map::lane::ContactLane tmpValue(mValue); 102 : 2 : ::ad::map::lane::ContactLane value; 103 : 1 : value = std::move(tmpValue); 104 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 105 : 1 : } 106 : : 107 : 2 : TEST_F(ContactLaneTests, comparisonOperatorEqual) 108 : : { 109 [ + - ]: 2 : ::ad::map::lane::ContactLane valueA = mValue; 110 [ + - ]: 2 : ::ad::map::lane::ContactLane valueB = mValue; 111 : : 112 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 113 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 114 : 1 : } 115 : : 116 : 2 : TEST_F(ContactLaneTests, stringConversionTest) 117 : : { 118 [ + - ]: 1 : std::stringstream stream; 119 [ + - ]: 1 : stream << mValue; 120 [ + - ]: 1 : std::string ostreamStr = stream.str(); 121 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 122 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - ] 123 : : } 124 : : 125 : 2 : TEST_F(ContactLaneTests, comparisonOperatorToLaneDiffers) 126 : : { 127 [ + - ]: 2 : ::ad::map::lane::ContactLane valueA = mValue; 128 : 1 : ::ad::map::lane::LaneId toLane(std::numeric_limits<::ad::map::lane::LaneId>::max()); 129 : 1 : valueA.toLane = toLane; 130 [ + - ]: 2 : ::ad::map::lane::ContactLane valueB = mValue; 131 : : 132 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 133 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 134 : 1 : } 135 : : 136 : 2 : TEST_F(ContactLaneTests, comparisonOperatorLocationDiffers) 137 : : { 138 [ + - ]: 2 : ::ad::map::lane::ContactLane valueA = mValue; 139 : 1 : ::ad::map::lane::ContactLocation location(::ad::map::lane::ContactLocation::OVERLAP); 140 : 1 : valueA.location = location; 141 [ + - ]: 2 : ::ad::map::lane::ContactLane valueB = mValue; 142 : : 143 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 144 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 145 : 1 : } 146 : : 147 : 2 : TEST_F(ContactLaneTests, comparisonOperatorTypesDiffers) 148 : : { 149 [ + - ]: 2 : ::ad::map::lane::ContactLane valueA = mValue; 150 : 2 : ::ad::map::lane::ContactTypeList types; 151 : 1 : ::ad::map::lane::ContactType typesElement(::ad::map::lane::ContactType::PRIO_TO_RIGHT_AND_STRAIGHT); 152 [ + - ]: 1 : types.resize(2, typesElement); 153 [ + - ]: 1 : valueA.types = types; 154 [ + - ]: 2 : ::ad::map::lane::ContactLane valueB = mValue; 155 : : 156 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 157 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 158 : 1 : } 159 : : 160 : 2 : TEST_F(ContactLaneTests, comparisonOperatorRestrictionsDiffers) 161 : : { 162 [ + - ]: 2 : ::ad::map::lane::ContactLane valueA = mValue; 163 : 2 : ::ad::map::restriction::Restrictions restrictions; 164 : 2 : ::ad::map::restriction::RestrictionList restrictionsConjunctions; 165 : 2 : ::ad::map::restriction::Restriction restrictionsConjunctionsElement; 166 : 1 : bool restrictionsConjunctionsElementNegated{false}; 167 : 1 : restrictionsConjunctionsElement.negated = restrictionsConjunctionsElementNegated; 168 : 2 : ::ad::map::restriction::RoadUserTypeList restrictionsConjunctionsElementRoadUserTypes; 169 : 1 : ::ad::map::restriction::RoadUserType restrictionsConjunctionsElementRoadUserTypesElement( 170 : : ::ad::map::restriction::RoadUserType::CAR_DIESEL); 171 [ + - ]: 1 : restrictionsConjunctionsElementRoadUserTypes.resize(2, restrictionsConjunctionsElementRoadUserTypesElement); 172 [ + - ]: 1 : restrictionsConjunctionsElement.roadUserTypes = restrictionsConjunctionsElementRoadUserTypes; 173 : 1 : ::ad::map::restriction::PassengerCount restrictionsConjunctionsElementPassengersMin( 174 : : std::numeric_limits<::ad::map::restriction::PassengerCount>::max()); 175 : 1 : restrictionsConjunctionsElement.passengersMin = restrictionsConjunctionsElementPassengersMin; 176 [ + - ]: 1 : restrictionsConjunctions.resize(2, restrictionsConjunctionsElement); 177 [ + - ]: 1 : restrictions.conjunctions = restrictionsConjunctions; 178 : 2 : ::ad::map::restriction::RestrictionList restrictionsDisjunctions; 179 : 2 : ::ad::map::restriction::Restriction restrictionsDisjunctionsElement; 180 : 1 : bool restrictionsDisjunctionsElementNegated{false}; 181 : 1 : restrictionsDisjunctionsElement.negated = restrictionsDisjunctionsElementNegated; 182 : 2 : ::ad::map::restriction::RoadUserTypeList restrictionsDisjunctionsElementRoadUserTypes; 183 : 1 : ::ad::map::restriction::RoadUserType restrictionsDisjunctionsElementRoadUserTypesElement( 184 : : ::ad::map::restriction::RoadUserType::CAR_DIESEL); 185 [ + - ]: 1 : restrictionsDisjunctionsElementRoadUserTypes.resize(2, restrictionsDisjunctionsElementRoadUserTypesElement); 186 [ + - ]: 1 : restrictionsDisjunctionsElement.roadUserTypes = restrictionsDisjunctionsElementRoadUserTypes; 187 : 1 : ::ad::map::restriction::PassengerCount restrictionsDisjunctionsElementPassengersMin( 188 : : std::numeric_limits<::ad::map::restriction::PassengerCount>::max()); 189 : 1 : restrictionsDisjunctionsElement.passengersMin = restrictionsDisjunctionsElementPassengersMin; 190 [ + - ]: 1 : restrictionsDisjunctions.resize(2, restrictionsDisjunctionsElement); 191 [ + - ]: 1 : restrictions.disjunctions = restrictionsDisjunctions; 192 [ + - ]: 1 : valueA.restrictions = restrictions; 193 [ + - ]: 2 : ::ad::map::lane::ContactLane valueB = mValue; 194 : : 195 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 196 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 197 : 1 : } 198 : : 199 : 2 : TEST_F(ContactLaneTests, comparisonOperatorTrafficLightIdDiffers) 200 : : { 201 [ + - ]: 2 : ::ad::map::lane::ContactLane valueA = mValue; 202 : 1 : ::ad::map::landmark::LandmarkId trafficLightId(std::numeric_limits<::ad::map::landmark::LandmarkId>::max()); 203 : 1 : valueA.trafficLightId = trafficLightId; 204 [ + - ]: 2 : ::ad::map::lane::ContactLane valueB = mValue; 205 : : 206 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 207 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 208 : 1 : } 209 : : 210 : : #if defined(__clang__) && (__clang_major__ >= 7) 211 : : #pragma GCC diagnostic pop 212 : : #endif