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/UnstructuredSceneStateInformation.hpp" 23 : : 24 : : class UnstructuredSceneStateInformationTests : public testing::Test 25 : : { 26 : : protected: 27 : 8 : virtual void SetUp() override 28 : : { 29 : : // valid initialization 30 : 16 : ::ad::rss::state::UnstructuredSceneStateInformation value; 31 : 16 : ::ad::physics::Distance2DList valueBrakeTrajectorySet; 32 : 8 : ::ad::physics::Distance2D valueBrakeTrajectorySetElement; 33 : 8 : ::ad::physics::Distance valueBrakeTrajectorySetElementX(-1e9); 34 : 8 : valueBrakeTrajectorySetElement.x = valueBrakeTrajectorySetElementX; 35 : 8 : ::ad::physics::Distance valueBrakeTrajectorySetElementY(-1e9); 36 : 8 : valueBrakeTrajectorySetElement.y = valueBrakeTrajectorySetElementY; 37 [ + - ]: 8 : valueBrakeTrajectorySet.resize(1, valueBrakeTrajectorySetElement); 38 [ + - ]: 8 : value.brakeTrajectorySet = valueBrakeTrajectorySet; 39 : 16 : ::ad::physics::Distance2DList valueContinueForwardTrajectorySet; 40 : 8 : ::ad::physics::Distance2D valueContinueForwardTrajectorySetElement; 41 : 8 : ::ad::physics::Distance valueContinueForwardTrajectorySetElementX(-1e9); 42 : 8 : valueContinueForwardTrajectorySetElement.x = valueContinueForwardTrajectorySetElementX; 43 : 8 : ::ad::physics::Distance valueContinueForwardTrajectorySetElementY(-1e9); 44 : 8 : valueContinueForwardTrajectorySetElement.y = valueContinueForwardTrajectorySetElementY; 45 [ + - ]: 8 : valueContinueForwardTrajectorySet.resize(1, valueContinueForwardTrajectorySetElement); 46 [ + - ]: 8 : value.continueForwardTrajectorySet = valueContinueForwardTrajectorySet; 47 [ + - ]: 8 : mValue = value; 48 : 8 : } 49 : : 50 : : ::ad::rss::state::UnstructuredSceneStateInformation mValue; 51 : : }; 52 : : 53 : 2 : TEST_F(UnstructuredSceneStateInformationTests, copyConstruction) 54 : : { 55 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation value(mValue); 56 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 57 : 1 : } 58 : : 59 : 2 : TEST_F(UnstructuredSceneStateInformationTests, moveConstruction) 60 : : { 61 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation tmpValue(mValue); 62 : 2 : ::ad::rss::state::UnstructuredSceneStateInformation value(std::move(tmpValue)); 63 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 64 : 1 : } 65 : : 66 : 2 : TEST_F(UnstructuredSceneStateInformationTests, copyAssignment) 67 : : { 68 : 2 : ::ad::rss::state::UnstructuredSceneStateInformation value; 69 [ + - ]: 1 : value = mValue; 70 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 71 : 1 : } 72 : : 73 : 2 : TEST_F(UnstructuredSceneStateInformationTests, moveAssignment) 74 : : { 75 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation tmpValue(mValue); 76 : 2 : ::ad::rss::state::UnstructuredSceneStateInformation value; 77 : 1 : value = std::move(tmpValue); 78 [ + - - + : 1 : EXPECT_EQ(mValue, value); - - - - - - ] 79 : 1 : } 80 : : 81 : 2 : TEST_F(UnstructuredSceneStateInformationTests, comparisonOperatorEqual) 82 : : { 83 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation valueA = mValue; 84 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation valueB = mValue; 85 : : 86 [ + - - + : 1 : EXPECT_TRUE(valueA == valueB); - - - - - - - - ] 87 [ + - - + : 1 : EXPECT_FALSE(valueA != valueB); - - - - - - - - ] 88 : 1 : } 89 : : 90 : 2 : TEST_F(UnstructuredSceneStateInformationTests, stringConversionTest) 91 : : { 92 [ + - ]: 1 : std::stringstream stream; 93 [ + - ]: 1 : stream << mValue; 94 [ + - ]: 1 : std::string ostreamStr = stream.str(); 95 [ + - ]: 1 : std::string toStr = std::to_string(mValue); 96 [ + - - + : 1 : ASSERT_EQ(ostreamStr, toStr); - - - - - - ] 97 : : } 98 : : 99 : 2 : TEST_F(UnstructuredSceneStateInformationTests, comparisonOperatorBrakeTrajectorySetDiffers) 100 : : { 101 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation valueA = mValue; 102 : 2 : ::ad::physics::Distance2DList brakeTrajectorySet; 103 : 1 : ::ad::physics::Distance2D brakeTrajectorySetElement; 104 : 1 : ::ad::physics::Distance brakeTrajectorySetElementX(1e9); 105 : 1 : brakeTrajectorySetElement.x = brakeTrajectorySetElementX; 106 : 1 : ::ad::physics::Distance brakeTrajectorySetElementY(1e9); 107 : 1 : brakeTrajectorySetElement.y = brakeTrajectorySetElementY; 108 [ + - ]: 1 : brakeTrajectorySet.resize(2, brakeTrajectorySetElement); 109 [ + - ]: 1 : valueA.brakeTrajectorySet = brakeTrajectorySet; 110 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation valueB = mValue; 111 : : 112 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 113 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 114 : 1 : } 115 : : 116 : 2 : TEST_F(UnstructuredSceneStateInformationTests, comparisonOperatorContinueForwardTrajectorySetDiffers) 117 : : { 118 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation valueA = mValue; 119 : 2 : ::ad::physics::Distance2DList continueForwardTrajectorySet; 120 : 1 : ::ad::physics::Distance2D continueForwardTrajectorySetElement; 121 : 1 : ::ad::physics::Distance continueForwardTrajectorySetElementX(1e9); 122 : 1 : continueForwardTrajectorySetElement.x = continueForwardTrajectorySetElementX; 123 : 1 : ::ad::physics::Distance continueForwardTrajectorySetElementY(1e9); 124 : 1 : continueForwardTrajectorySetElement.y = continueForwardTrajectorySetElementY; 125 [ + - ]: 1 : continueForwardTrajectorySet.resize(2, continueForwardTrajectorySetElement); 126 [ + - ]: 1 : valueA.continueForwardTrajectorySet = continueForwardTrajectorySet; 127 [ + - ]: 2 : ::ad::rss::state::UnstructuredSceneStateInformation valueB = mValue; 128 : : 129 [ + - - + : 1 : EXPECT_FALSE(valueA == valueB); - - - - - - - - ] 130 [ + - - + : 1 : EXPECT_TRUE(valueA != valueB); - - - - - - - - ] 131 : 1 : } 132 : : 133 : : #if defined(__clang__) && (__clang_major__ >= 7) 134 : : #pragma GCC diagnostic pop 135 : : #endif