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 : : #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/rss/state/UnstructuredSceneRssState.hpp" 23 : : 24 : : class UnstructuredSceneRssStateTests : public testing::Test 25 : : { 26 : : protected: 27 : 11 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 22 : ::ad::rss::state::UnstructuredSceneRssState value; 31 : 11 : bool valueIsSafe{true}; 32 : 11 : value.isSafe = valueIsSafe; 33 : 11 : ::ad::rss::state::UnstructuredSceneResponse valueResponse(::ad::rss::state::UnstructuredSceneResponse::None); 34 : 11 : value.response = valueResponse; 35 : 11 : ::ad::rss::state::HeadingRange valueHeadingRange; 36 : 11 : ::ad::physics::Angle valueHeadingRangeBegin(-6.283185308); 37 : 11 : valueHeadingRange.begin = valueHeadingRangeBegin; 38 : 11 : ::ad::physics::Angle valueHeadingRangeEnd(-6.283185308); 39 : 11 : valueHeadingRange.end = valueHeadingRangeEnd; 40 : 11 : value.headingRange = valueHeadingRange; 41 : 22 : ::ad::rss::state::UnstructuredSceneStateInformation valueRssStateInformation; 42 : 22 : ::ad::physics::Distance2DList valueRssStateInformationBrakeTrajectorySet; 43 : 11 : ::ad::physics::Distance2D valueRssStateInformationBrakeTrajectorySetElement; 44 : 11 : ::ad::physics::Distance valueRssStateInformationBrakeTrajectorySetElementX(-1e9); 45 : 11 : valueRssStateInformationBrakeTrajectorySetElement.x = valueRssStateInformationBrakeTrajectorySetElementX; 46 : 11 : ::ad::physics::Distance valueRssStateInformationBrakeTrajectorySetElementY(-1e9); 47 : 11 : valueRssStateInformationBrakeTrajectorySetElement.y = valueRssStateInformationBrakeTrajectorySetElementY; 48 [ + - ]: 11 : valueRssStateInformationBrakeTrajectorySet.resize(1, valueRssStateInformationBrakeTrajectorySetElement); 49 [ + - ]: 11 : valueRssStateInformation.brakeTrajectorySet = valueRssStateInformationBrakeTrajectorySet; 50 : 22 : ::ad::physics::Distance2DList valueRssStateInformationContinueForwardTrajectorySet; 51 : 11 : ::ad::physics::Distance2D valueRssStateInformationContinueForwardTrajectorySetElement; 52 : 11 : ::ad::physics::Distance valueRssStateInformationContinueForwardTrajectorySetElementX(-1e9); 53 : : valueRssStateInformationContinueForwardTrajectorySetElement.x 54 : 11 : = valueRssStateInformationContinueForwardTrajectorySetElementX; 55 : 11 : ::ad::physics::Distance valueRssStateInformationContinueForwardTrajectorySetElementY(-1e9); 56 : : valueRssStateInformationContinueForwardTrajectorySetElement.y 57 : 11 : = valueRssStateInformationContinueForwardTrajectorySetElementY; 58 [ + - ]: 11 : valueRssStateInformationContinueForwardTrajectorySet.resize( 59 : : 1, valueRssStateInformationContinueForwardTrajectorySetElement); 60 [ + - ]: 11 : valueRssStateInformation.continueForwardTrajectorySet = valueRssStateInformationContinueForwardTrajectorySet; 61 [ + - ]: 11 : value.rssStateInformation = valueRssStateInformation; 62 : 11 : ::ad::rss::world::LongitudinalRssAccelerationValues valueAlphaLon; 63 : 11 : ::ad::physics::Acceleration valueAlphaLonAccelMax(-1e2); 64 : 11 : valueAlphaLonAccelMax = ::ad::physics::Acceleration(0.); // set to valid value within struct 65 : 11 : valueAlphaLon.accelMax = valueAlphaLonAccelMax; 66 : 11 : ::ad::physics::Acceleration valueAlphaLonBrakeMax(-1e2); 67 : 11 : valueAlphaLon.brakeMax = valueAlphaLonBrakeMax; 68 : 11 : ::ad::physics::Acceleration valueAlphaLonBrakeMin(-1e2); 69 : 11 : valueAlphaLon.brakeMin = valueAlphaLonBrakeMin; 70 : 11 : ::ad::physics::Acceleration valueAlphaLonBrakeMinCorrect(-1e2); 71 : 11 : valueAlphaLon.brakeMinCorrect = valueAlphaLonBrakeMinCorrect; 72 : 11 : valueAlphaLon.brakeMin = valueAlphaLon.brakeMax; 73 : 11 : valueAlphaLon.brakeMinCorrect = valueAlphaLon.brakeMin; 74 : 11 : valueAlphaLon.brakeMin = valueAlphaLon.brakeMinCorrect; 75 : 11 : valueAlphaLon.brakeMax = valueAlphaLon.brakeMin; 76 : 11 : value.alphaLon = valueAlphaLon; 77 [ + - ]: 11 : mValue = value; 78 : 11 : } 79 : : 80 : : ::ad::rss::state::UnstructuredSceneRssState mValue; 81 : : }; 82 : : 83 : 2 : TEST_F(UnstructuredSceneRssStateTests, copyConstruction) 84 : : { 85 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState value(mValue); 86 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 87 : 1 : } 88 : : 89 : 2 : TEST_F(UnstructuredSceneRssStateTests, moveConstruction) 90 : : { 91 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState tmpValue(mValue); 92 : 2 : ::ad::rss::state::UnstructuredSceneRssState value(std::move(tmpValue)); 93 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 94 : 1 : } 95 : : 96 : 2 : TEST_F(UnstructuredSceneRssStateTests, copyAssignment) 97 : : { 98 : 2 : ::ad::rss::state::UnstructuredSceneRssState value; 99 [ + - ]: 1 : value = mValue; 100 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 101 : 1 : } 102 : : 103 : 2 : TEST_F(UnstructuredSceneRssStateTests, moveAssignment) 104 : : { 105 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState tmpValue(mValue); 106 : 2 : ::ad::rss::state::UnstructuredSceneRssState value; 107 : 1 : value = std::move(tmpValue); 108 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 109 : 1 : } 110 : : 111 : 2 : TEST_F(UnstructuredSceneRssStateTests, comparisonOperatorEqual) 112 : : { 113 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueA = mValue; 114 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueB = mValue; 115 : : 116 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 117 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 118 : 1 : } 119 : : 120 : 2 : TEST_F(UnstructuredSceneRssStateTests, stringConversionTest) 121 : : { 122 [ + - ]: 1 : std::stringstream stream; 123 [ + - ]: 1 : stream << mValue; 124 [ + - ]: 1 : std::string ostreamStr = stream.str(); 125 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 126 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - ] 127 : : } 128 : : 129 : 2 : TEST_F(UnstructuredSceneRssStateTests, comparisonOperatorIsSafeDiffers) 130 : : { 131 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueA = mValue; 132 : 1 : bool isSafe{false}; 133 : 1 : valueA.isSafe = isSafe; 134 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueB = mValue; 135 : : 136 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 137 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 138 : 1 : } 139 : : 140 : 2 : TEST_F(UnstructuredSceneRssStateTests, comparisonOperatorResponseDiffers) 141 : : { 142 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueA = mValue; 143 : 1 : ::ad::rss::state::UnstructuredSceneResponse response(::ad::rss::state::UnstructuredSceneResponse::Brake); 144 : 1 : valueA.response = response; 145 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueB = mValue; 146 : : 147 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 148 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 149 : 1 : } 150 : : 151 : 2 : TEST_F(UnstructuredSceneRssStateTests, comparisonOperatorHeadingRangeDiffers) 152 : : { 153 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueA = mValue; 154 : 1 : ::ad::rss::state::HeadingRange headingRange; 155 : 1 : ::ad::physics::Angle headingRangeBegin(6.283185308); 156 : 1 : headingRange.begin = headingRangeBegin; 157 : 1 : ::ad::physics::Angle headingRangeEnd(6.283185308); 158 : 1 : headingRange.end = headingRangeEnd; 159 : 1 : valueA.headingRange = headingRange; 160 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueB = mValue; 161 : : 162 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 163 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 164 : 1 : } 165 : : 166 : 2 : TEST_F(UnstructuredSceneRssStateTests, comparisonOperatorRssStateInformationDiffers) 167 : : { 168 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueA = mValue; 169 : 2 : ::ad::rss::state::UnstructuredSceneStateInformation rssStateInformation; 170 : 2 : ::ad::physics::Distance2DList rssStateInformationBrakeTrajectorySet; 171 : 1 : ::ad::physics::Distance2D rssStateInformationBrakeTrajectorySetElement; 172 : 1 : ::ad::physics::Distance rssStateInformationBrakeTrajectorySetElementX(1e9); 173 : 1 : rssStateInformationBrakeTrajectorySetElement.x = rssStateInformationBrakeTrajectorySetElementX; 174 : 1 : ::ad::physics::Distance rssStateInformationBrakeTrajectorySetElementY(1e9); 175 : 1 : rssStateInformationBrakeTrajectorySetElement.y = rssStateInformationBrakeTrajectorySetElementY; 176 [ + - ]: 1 : rssStateInformationBrakeTrajectorySet.resize(2, rssStateInformationBrakeTrajectorySetElement); 177 [ + - ]: 1 : rssStateInformation.brakeTrajectorySet = rssStateInformationBrakeTrajectorySet; 178 : 2 : ::ad::physics::Distance2DList rssStateInformationContinueForwardTrajectorySet; 179 : 1 : ::ad::physics::Distance2D rssStateInformationContinueForwardTrajectorySetElement; 180 : 1 : ::ad::physics::Distance rssStateInformationContinueForwardTrajectorySetElementX(1e9); 181 : 1 : rssStateInformationContinueForwardTrajectorySetElement.x = rssStateInformationContinueForwardTrajectorySetElementX; 182 : 1 : ::ad::physics::Distance rssStateInformationContinueForwardTrajectorySetElementY(1e9); 183 : 1 : rssStateInformationContinueForwardTrajectorySetElement.y = rssStateInformationContinueForwardTrajectorySetElementY; 184 [ + - ]: 1 : rssStateInformationContinueForwardTrajectorySet.resize(2, rssStateInformationContinueForwardTrajectorySetElement); 185 [ + - ]: 1 : rssStateInformation.continueForwardTrajectorySet = rssStateInformationContinueForwardTrajectorySet; 186 [ + - ]: 1 : valueA.rssStateInformation = rssStateInformation; 187 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueB = mValue; 188 : : 189 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 190 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 191 : 1 : } 192 : : 193 : 2 : TEST_F(UnstructuredSceneRssStateTests, comparisonOperatorAlphaLonDiffers) 194 : : { 195 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueA = mValue; 196 : 1 : ::ad::rss::world::LongitudinalRssAccelerationValues alphaLon; 197 : 1 : ::ad::physics::Acceleration alphaLonAccelMax(1e2); 198 : 1 : alphaLon.accelMax = alphaLonAccelMax; 199 : 1 : ::ad::physics::Acceleration alphaLonBrakeMax(1e2); 200 : 1 : alphaLon.brakeMax = alphaLonBrakeMax; 201 : 1 : ::ad::physics::Acceleration alphaLonBrakeMin(1e2); 202 : 1 : alphaLon.brakeMin = alphaLonBrakeMin; 203 : 1 : ::ad::physics::Acceleration alphaLonBrakeMinCorrect(1e2); 204 : 1 : alphaLonBrakeMinCorrect = ::ad::physics::Acceleration(0. * 0.9); // set to valid value within struct 205 : 1 : alphaLon.brakeMinCorrect = alphaLonBrakeMinCorrect; 206 : 1 : alphaLon.brakeMinCorrect = alphaLon.brakeMin; 207 : 1 : alphaLon.brakeMin = alphaLon.brakeMax; 208 : 1 : alphaLon.brakeMax = alphaLon.brakeMin; 209 : 1 : alphaLon.brakeMin = alphaLon.brakeMinCorrect; 210 : 1 : valueA.alphaLon = alphaLon; 211 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneRssState valueB = mValue; 212 : : 213 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 214 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 215 : 1 : } 216 : : 217 : : #if defined(__clang__) && (__clang_major__ >= 7) 218 : : #pragma GCC diagnostic pop 219 : : #endif