LCOV - code coverage report
Current view: top level - tests/generated/ad/rss/state - ProperResponseTests.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 191 191 100.0 %
Date: 2024-12-17 12:06:18 Functions: 31 31 100.0 %
Branches: 87 364 23.9 %

           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/ProperResponse.hpp"
      23                 :            : 
      24                 :            : class ProperResponseTests : public testing::Test
      25                 :            : {
      26                 :            : protected:
      27                 :         15 :   virtual void SetUp() override
      28                 :            :   {
      29                 :            :     // valid initialization
      30                 :         30 :     ::ad::rss::state::ProperResponse value;
      31                 :         15 :     ::ad::rss::world::TimeIndex valueTimeIndex(std::numeric_limits<::ad::rss::world::TimeIndex>::lowest());
      32                 :         15 :     valueTimeIndex = ::ad::rss::world::TimeIndex(1); // set to valid value within struct
      33                 :         15 :     value.timeIndex = valueTimeIndex;
      34                 :         15 :     bool valueIsSafe{true};
      35                 :         15 :     value.isSafe = valueIsSafe;
      36                 :         30 :     ::ad::rss::world::ObjectIdVector valueDangerousObjects;
      37                 :         15 :     ::ad::rss::world::ObjectId valueDangerousObjectsElement(std::numeric_limits<::ad::rss::world::ObjectId>::lowest());
      38         [ +  - ]:         15 :     valueDangerousObjects.resize(1, valueDangerousObjectsElement);
      39         [ +  - ]:         15 :     value.dangerousObjects = valueDangerousObjects;
      40                 :         15 :     ::ad::rss::state::LongitudinalResponse valueLongitudinalResponse(::ad::rss::state::LongitudinalResponse::None);
      41                 :         15 :     value.longitudinalResponse = valueLongitudinalResponse;
      42                 :         15 :     ::ad::rss::state::LateralResponse valueLateralResponseRight(::ad::rss::state::LateralResponse::None);
      43                 :         15 :     value.lateralResponseRight = valueLateralResponseRight;
      44                 :         15 :     ::ad::rss::state::LateralResponse valueLateralResponseLeft(::ad::rss::state::LateralResponse::None);
      45                 :         15 :     value.lateralResponseLeft = valueLateralResponseLeft;
      46                 :         30 :     ::ad::rss::state::HeadingRangeVector valueHeadingRanges;
      47                 :         15 :     ::ad::rss::state::HeadingRange valueHeadingRangesElement;
      48                 :         15 :     ::ad::physics::Angle valueHeadingRangesElementBegin(-6.283185308);
      49                 :         15 :     valueHeadingRangesElement.begin = valueHeadingRangesElementBegin;
      50                 :         15 :     ::ad::physics::Angle valueHeadingRangesElementEnd(-6.283185308);
      51                 :         15 :     valueHeadingRangesElement.end = valueHeadingRangesElementEnd;
      52         [ +  - ]:         15 :     valueHeadingRanges.resize(1, valueHeadingRangesElement);
      53         [ +  - ]:         15 :     value.headingRanges = valueHeadingRanges;
      54                 :         15 :     ::ad::rss::state::AccelerationRestriction valueAccelerationRestrictions;
      55                 :         15 :     ::ad::physics::AccelerationRange valueAccelerationRestrictionsLateralLeftRange;
      56                 :         15 :     ::ad::physics::Acceleration valueAccelerationRestrictionsLateralLeftRangeMinimum(-1e2);
      57                 :         15 :     valueAccelerationRestrictionsLateralLeftRange.minimum = valueAccelerationRestrictionsLateralLeftRangeMinimum;
      58                 :         15 :     ::ad::physics::Acceleration valueAccelerationRestrictionsLateralLeftRangeMaximum(-1e2);
      59                 :         15 :     valueAccelerationRestrictionsLateralLeftRange.maximum = valueAccelerationRestrictionsLateralLeftRangeMaximum;
      60                 :         15 :     valueAccelerationRestrictionsLateralLeftRange.maximum = valueAccelerationRestrictionsLateralLeftRange.minimum;
      61                 :         15 :     valueAccelerationRestrictionsLateralLeftRange.minimum = valueAccelerationRestrictionsLateralLeftRange.maximum;
      62                 :         15 :     valueAccelerationRestrictions.lateralLeftRange = valueAccelerationRestrictionsLateralLeftRange;
      63                 :         15 :     ::ad::physics::AccelerationRange valueAccelerationRestrictionsLongitudinalRange;
      64                 :         15 :     ::ad::physics::Acceleration valueAccelerationRestrictionsLongitudinalRangeMinimum(-1e2);
      65                 :         15 :     valueAccelerationRestrictionsLongitudinalRange.minimum = valueAccelerationRestrictionsLongitudinalRangeMinimum;
      66                 :         15 :     ::ad::physics::Acceleration valueAccelerationRestrictionsLongitudinalRangeMaximum(-1e2);
      67                 :         15 :     valueAccelerationRestrictionsLongitudinalRange.maximum = valueAccelerationRestrictionsLongitudinalRangeMaximum;
      68                 :         15 :     valueAccelerationRestrictionsLongitudinalRange.maximum = valueAccelerationRestrictionsLongitudinalRange.minimum;
      69                 :         15 :     valueAccelerationRestrictionsLongitudinalRange.minimum = valueAccelerationRestrictionsLongitudinalRange.maximum;
      70                 :         15 :     valueAccelerationRestrictions.longitudinalRange = valueAccelerationRestrictionsLongitudinalRange;
      71                 :         15 :     ::ad::physics::AccelerationRange valueAccelerationRestrictionsLateralRightRange;
      72                 :         15 :     ::ad::physics::Acceleration valueAccelerationRestrictionsLateralRightRangeMinimum(-1e2);
      73                 :         15 :     valueAccelerationRestrictionsLateralRightRange.minimum = valueAccelerationRestrictionsLateralRightRangeMinimum;
      74                 :         15 :     ::ad::physics::Acceleration valueAccelerationRestrictionsLateralRightRangeMaximum(-1e2);
      75                 :         15 :     valueAccelerationRestrictionsLateralRightRange.maximum = valueAccelerationRestrictionsLateralRightRangeMaximum;
      76                 :         15 :     valueAccelerationRestrictionsLateralRightRange.maximum = valueAccelerationRestrictionsLateralRightRange.minimum;
      77                 :         15 :     valueAccelerationRestrictionsLateralRightRange.minimum = valueAccelerationRestrictionsLateralRightRange.maximum;
      78                 :         15 :     valueAccelerationRestrictions.lateralRightRange = valueAccelerationRestrictionsLateralRightRange;
      79                 :         15 :     value.accelerationRestrictions = valueAccelerationRestrictions;
      80                 :         15 :     ::ad::rss::state::UnstructuredSceneResponse valueUnstructuredSceneResponse(
      81                 :            :       ::ad::rss::state::UnstructuredSceneResponse::None);
      82                 :         15 :     value.unstructuredSceneResponse = valueUnstructuredSceneResponse;
      83         [ +  - ]:         15 :     mValue = value;
      84                 :         15 :   }
      85                 :            : 
      86                 :            :   ::ad::rss::state::ProperResponse mValue;
      87                 :            : };
      88                 :            : 
      89                 :          2 : TEST_F(ProperResponseTests, copyConstruction)
      90                 :            : {
      91         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse value(mValue);
      92   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      93                 :          1 : }
      94                 :            : 
      95                 :          2 : TEST_F(ProperResponseTests, moveConstruction)
      96                 :            : {
      97         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse tmpValue(mValue);
      98                 :          2 :   ::ad::rss::state::ProperResponse value(std::move(tmpValue));
      99   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
     100                 :          1 : }
     101                 :            : 
     102                 :          2 : TEST_F(ProperResponseTests, copyAssignment)
     103                 :            : {
     104                 :          2 :   ::ad::rss::state::ProperResponse value;
     105         [ +  - ]:          1 :   value = mValue;
     106   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
     107                 :          1 : }
     108                 :            : 
     109                 :          2 : TEST_F(ProperResponseTests, moveAssignment)
     110                 :            : {
     111         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse tmpValue(mValue);
     112                 :          2 :   ::ad::rss::state::ProperResponse value;
     113                 :          1 :   value = std::move(tmpValue);
     114   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
     115                 :          1 : }
     116                 :            : 
     117                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorEqual)
     118                 :            : {
     119         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     120         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     121                 :            : 
     122   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     123   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     124                 :          1 : }
     125                 :            : 
     126                 :          2 : TEST_F(ProperResponseTests, stringConversionTest)
     127                 :            : {
     128         [ +  - ]:          1 :   std::stringstream stream;
     129         [ +  - ]:          1 :   stream << mValue;
     130         [ +  - ]:          1 :   std::string ostreamStr = stream.str();
     131         [ +  - ]:          1 :   std::string toStr = std::to_string(mValue);
     132   [ +  -  -  +  :          1 :   ASSERT_EQ(ostreamStr, toStr);
          -  -  -  -  -  
                      - ]
     133                 :            : }
     134                 :            : 
     135                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorTimeIndexDiffers)
     136                 :            : {
     137         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     138                 :          1 :   ::ad::rss::world::TimeIndex timeIndex(std::numeric_limits<::ad::rss::world::TimeIndex>::max());
     139                 :          1 :   valueA.timeIndex = timeIndex;
     140         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     141                 :            : 
     142   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     143   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     144                 :          1 : }
     145                 :            : 
     146                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorIsSafeDiffers)
     147                 :            : {
     148         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     149                 :          1 :   bool isSafe{false};
     150                 :          1 :   valueA.isSafe = isSafe;
     151         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     152                 :            : 
     153   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     154   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     155                 :          1 : }
     156                 :            : 
     157                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorDangerousObjectsDiffers)
     158                 :            : {
     159         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     160                 :          2 :   ::ad::rss::world::ObjectIdVector dangerousObjects;
     161                 :          1 :   ::ad::rss::world::ObjectId dangerousObjectsElement(std::numeric_limits<::ad::rss::world::ObjectId>::max());
     162         [ +  - ]:          1 :   dangerousObjects.resize(0 + 1, dangerousObjectsElement);
     163         [ +  - ]:          1 :   valueA.dangerousObjects = dangerousObjects;
     164         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     165                 :            : 
     166   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     167   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     168                 :          1 : }
     169                 :            : 
     170                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorLongitudinalResponseDiffers)
     171                 :            : {
     172         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     173                 :          1 :   ::ad::rss::state::LongitudinalResponse longitudinalResponse(::ad::rss::state::LongitudinalResponse::BrakeMin);
     174                 :          1 :   valueA.longitudinalResponse = longitudinalResponse;
     175         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     176                 :            : 
     177   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     178   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     179                 :          1 : }
     180                 :            : 
     181                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorLateralResponseRightDiffers)
     182                 :            : {
     183         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     184                 :          1 :   ::ad::rss::state::LateralResponse lateralResponseRight(::ad::rss::state::LateralResponse::BrakeMin);
     185                 :          1 :   valueA.lateralResponseRight = lateralResponseRight;
     186         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     187                 :            : 
     188   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     189   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     190                 :          1 : }
     191                 :            : 
     192                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorLateralResponseLeftDiffers)
     193                 :            : {
     194         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     195                 :          1 :   ::ad::rss::state::LateralResponse lateralResponseLeft(::ad::rss::state::LateralResponse::BrakeMin);
     196                 :          1 :   valueA.lateralResponseLeft = lateralResponseLeft;
     197         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     198                 :            : 
     199   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     200   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     201                 :          1 : }
     202                 :            : 
     203                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorHeadingRangesDiffers)
     204                 :            : {
     205         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     206                 :          2 :   ::ad::rss::state::HeadingRangeVector headingRanges;
     207                 :          1 :   ::ad::rss::state::HeadingRange headingRangesElement;
     208                 :          1 :   ::ad::physics::Angle headingRangesElementBegin(6.283185308);
     209                 :          1 :   headingRangesElement.begin = headingRangesElementBegin;
     210                 :          1 :   ::ad::physics::Angle headingRangesElementEnd(6.283185308);
     211                 :          1 :   headingRangesElement.end = headingRangesElementEnd;
     212         [ +  - ]:          1 :   headingRanges.resize(2, headingRangesElement);
     213         [ +  - ]:          1 :   valueA.headingRanges = headingRanges;
     214         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     215                 :            : 
     216   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     217   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     218                 :          1 : }
     219                 :            : 
     220                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorAccelerationRestrictionsDiffers)
     221                 :            : {
     222         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     223                 :          1 :   ::ad::rss::state::AccelerationRestriction accelerationRestrictions;
     224                 :          1 :   ::ad::physics::AccelerationRange accelerationRestrictionsLateralLeftRange;
     225                 :          1 :   ::ad::physics::Acceleration accelerationRestrictionsLateralLeftRangeMinimum(1e2);
     226                 :          1 :   accelerationRestrictionsLateralLeftRange.minimum = accelerationRestrictionsLateralLeftRangeMinimum;
     227                 :          1 :   ::ad::physics::Acceleration accelerationRestrictionsLateralLeftRangeMaximum(1e2);
     228                 :          1 :   accelerationRestrictionsLateralLeftRange.maximum = accelerationRestrictionsLateralLeftRangeMaximum;
     229                 :          1 :   accelerationRestrictionsLateralLeftRange.maximum = accelerationRestrictionsLateralLeftRange.minimum;
     230                 :          1 :   accelerationRestrictionsLateralLeftRange.minimum = accelerationRestrictionsLateralLeftRange.maximum;
     231                 :          1 :   accelerationRestrictions.lateralLeftRange = accelerationRestrictionsLateralLeftRange;
     232                 :          1 :   ::ad::physics::AccelerationRange accelerationRestrictionsLongitudinalRange;
     233                 :          1 :   ::ad::physics::Acceleration accelerationRestrictionsLongitudinalRangeMinimum(1e2);
     234                 :          1 :   accelerationRestrictionsLongitudinalRange.minimum = accelerationRestrictionsLongitudinalRangeMinimum;
     235                 :          1 :   ::ad::physics::Acceleration accelerationRestrictionsLongitudinalRangeMaximum(1e2);
     236                 :          1 :   accelerationRestrictionsLongitudinalRange.maximum = accelerationRestrictionsLongitudinalRangeMaximum;
     237                 :          1 :   accelerationRestrictionsLongitudinalRange.maximum = accelerationRestrictionsLongitudinalRange.minimum;
     238                 :          1 :   accelerationRestrictionsLongitudinalRange.minimum = accelerationRestrictionsLongitudinalRange.maximum;
     239                 :          1 :   accelerationRestrictions.longitudinalRange = accelerationRestrictionsLongitudinalRange;
     240                 :          1 :   ::ad::physics::AccelerationRange accelerationRestrictionsLateralRightRange;
     241                 :          1 :   ::ad::physics::Acceleration accelerationRestrictionsLateralRightRangeMinimum(1e2);
     242                 :          1 :   accelerationRestrictionsLateralRightRange.minimum = accelerationRestrictionsLateralRightRangeMinimum;
     243                 :          1 :   ::ad::physics::Acceleration accelerationRestrictionsLateralRightRangeMaximum(1e2);
     244                 :          1 :   accelerationRestrictionsLateralRightRange.maximum = accelerationRestrictionsLateralRightRangeMaximum;
     245                 :          1 :   accelerationRestrictionsLateralRightRange.maximum = accelerationRestrictionsLateralRightRange.minimum;
     246                 :          1 :   accelerationRestrictionsLateralRightRange.minimum = accelerationRestrictionsLateralRightRange.maximum;
     247                 :          1 :   accelerationRestrictions.lateralRightRange = accelerationRestrictionsLateralRightRange;
     248                 :          1 :   valueA.accelerationRestrictions = accelerationRestrictions;
     249         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     250                 :            : 
     251   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     252   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     253                 :          1 : }
     254                 :            : 
     255                 :          2 : TEST_F(ProperResponseTests, comparisonOperatorUnstructuredSceneResponseDiffers)
     256                 :            : {
     257         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueA = mValue;
     258                 :          1 :   ::ad::rss::state::UnstructuredSceneResponse unstructuredSceneResponse(
     259                 :            :     ::ad::rss::state::UnstructuredSceneResponse::Brake);
     260                 :          1 :   valueA.unstructuredSceneResponse = unstructuredSceneResponse;
     261         [ +  - ]:          2 :   ::ad::rss::state::ProperResponse valueB = mValue;
     262                 :            : 
     263   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     264   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     265                 :          1 : }
     266                 :            : 
     267                 :            : #if defined(__clang__) && (__clang_major__ >= 7)
     268                 :            : #pragma GCC diagnostic pop
     269                 :            : #endif

Generated by: LCOV version 1.14