LCOV - code coverage report
Current view: top level - tests/generated/ad/rss/state - ProperResponseTests.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 192 192 100.0 %
Date: 2025-07-22 06:53:46 Functions: 46 46 100.0 %
Branches: 91 372 24.5 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
       3                 :            :  *
       4                 :            :  * Copyright (C) 2018-2022 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                 :         15 :     ::ad::rss::state::ProperResponse value;
      31                 :         15 :     ::ad::rss::world::TimeIndex valueTime_index(std::numeric_limits<::ad::rss::world::TimeIndex>::lowest());
      32                 :         15 :     valueTime_index = ::ad::rss::world::TimeIndex(1); // set to valid value within struct
      33                 :         15 :     value.time_index = valueTime_index;
      34                 :         15 :     bool valueIs_safe{true};
      35                 :         15 :     value.is_safe = valueIs_safe;
      36                 :         15 :     ::ad::rss::world::ObjectIdVector valueDangerous_objects;
      37                 :         15 :     ::ad::rss::world::ObjectId valueDangerous_objectsElement(std::numeric_limits<::ad::rss::world::ObjectId>::lowest());
      38         [ +  - ]:         15 :     valueDangerous_objects.resize(1, valueDangerous_objectsElement);
      39         [ +  - ]:         15 :     value.dangerous_objects = valueDangerous_objects;
      40                 :         15 :     ::ad::rss::state::LongitudinalResponse valueLongitudinal_response(::ad::rss::state::LongitudinalResponse::None);
      41                 :         15 :     value.longitudinal_response = valueLongitudinal_response;
      42                 :         15 :     ::ad::rss::state::LateralResponse valueLateral_response_right(::ad::rss::state::LateralResponse::None);
      43                 :         15 :     value.lateral_response_right = valueLateral_response_right;
      44                 :         15 :     ::ad::rss::state::LateralResponse valueLateral_response_left(::ad::rss::state::LateralResponse::None);
      45                 :         15 :     value.lateral_response_left = valueLateral_response_left;
      46                 :         15 :     ::ad::geometry::HeadingRangeVector valueHeading_ranges;
      47                 :         15 :     ::ad::geometry::HeadingRange valueHeading_rangesElement;
      48                 :         15 :     ::ad::physics::Angle valueHeading_rangesElementBegin(-6.283185308);
      49                 :         15 :     valueHeading_rangesElement.begin = valueHeading_rangesElementBegin;
      50                 :         15 :     ::ad::physics::Angle valueHeading_rangesElementEnd(-6.283185308);
      51                 :         15 :     valueHeading_rangesElement.end = valueHeading_rangesElementEnd;
      52         [ +  - ]:         15 :     valueHeading_ranges.resize(1, valueHeading_rangesElement);
      53         [ +  - ]:         15 :     value.heading_ranges = valueHeading_ranges;
      54                 :         15 :     ::ad::rss::state::AccelerationRestriction valueAcceleration_restrictions;
      55                 :         15 :     ::ad::physics::AccelerationRange valueAcceleration_restrictionsLateral_left_range;
      56                 :         15 :     ::ad::physics::Acceleration valueAcceleration_restrictionsLateral_left_rangeMinimum(-1e2);
      57                 :         15 :     valueAcceleration_restrictionsLateral_left_range.minimum = valueAcceleration_restrictionsLateral_left_rangeMinimum;
      58                 :         15 :     ::ad::physics::Acceleration valueAcceleration_restrictionsLateral_left_rangeMaximum(-1e2);
      59                 :         15 :     valueAcceleration_restrictionsLateral_left_range.maximum = valueAcceleration_restrictionsLateral_left_rangeMaximum;
      60                 :         15 :     valueAcceleration_restrictionsLateral_left_range.maximum = valueAcceleration_restrictionsLateral_left_range.minimum;
      61                 :         15 :     valueAcceleration_restrictionsLateral_left_range.minimum = valueAcceleration_restrictionsLateral_left_range.maximum;
      62                 :         15 :     valueAcceleration_restrictions.lateral_left_range = valueAcceleration_restrictionsLateral_left_range;
      63                 :         15 :     ::ad::physics::AccelerationRange valueAcceleration_restrictionsLongitudinal_range;
      64                 :         15 :     ::ad::physics::Acceleration valueAcceleration_restrictionsLongitudinal_rangeMinimum(-1e2);
      65                 :         15 :     valueAcceleration_restrictionsLongitudinal_range.minimum = valueAcceleration_restrictionsLongitudinal_rangeMinimum;
      66                 :         15 :     ::ad::physics::Acceleration valueAcceleration_restrictionsLongitudinal_rangeMaximum(-1e2);
      67                 :         15 :     valueAcceleration_restrictionsLongitudinal_range.maximum = valueAcceleration_restrictionsLongitudinal_rangeMaximum;
      68                 :         15 :     valueAcceleration_restrictionsLongitudinal_range.maximum = valueAcceleration_restrictionsLongitudinal_range.minimum;
      69                 :         15 :     valueAcceleration_restrictionsLongitudinal_range.minimum = valueAcceleration_restrictionsLongitudinal_range.maximum;
      70                 :         15 :     valueAcceleration_restrictions.longitudinal_range = valueAcceleration_restrictionsLongitudinal_range;
      71                 :         15 :     ::ad::physics::AccelerationRange valueAcceleration_restrictionsLateral_right_range;
      72                 :         15 :     ::ad::physics::Acceleration valueAcceleration_restrictionsLateral_right_rangeMinimum(-1e2);
      73                 :            :     valueAcceleration_restrictionsLateral_right_range.minimum
      74                 :         15 :       = valueAcceleration_restrictionsLateral_right_rangeMinimum;
      75                 :         15 :     ::ad::physics::Acceleration valueAcceleration_restrictionsLateral_right_rangeMaximum(-1e2);
      76                 :            :     valueAcceleration_restrictionsLateral_right_range.maximum
      77                 :         15 :       = valueAcceleration_restrictionsLateral_right_rangeMaximum;
      78                 :            :     valueAcceleration_restrictionsLateral_right_range.maximum
      79                 :         15 :       = valueAcceleration_restrictionsLateral_right_range.minimum;
      80                 :            :     valueAcceleration_restrictionsLateral_right_range.minimum
      81                 :         15 :       = valueAcceleration_restrictionsLateral_right_range.maximum;
      82                 :         15 :     valueAcceleration_restrictions.lateral_right_range = valueAcceleration_restrictionsLateral_right_range;
      83                 :         15 :     value.acceleration_restrictions = valueAcceleration_restrictions;
      84                 :         15 :     ::ad::rss::state::UnstructuredConstellationResponse valueUnstructured_constellation_response(
      85                 :            :       ::ad::rss::state::UnstructuredConstellationResponse::None);
      86                 :         15 :     value.unstructured_constellation_response = valueUnstructured_constellation_response;
      87         [ +  - ]:         15 :     mValue = value;
      88                 :         15 :   }
      89                 :            : 
      90                 :            :   ::ad::rss::state::ProperResponse mValue;
      91                 :            : };
      92                 :            : 
      93                 :          4 : TEST_F(ProperResponseTests, copyConstruction)
      94                 :            : {
      95         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse value(mValue);
      96   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      97                 :          1 : }
      98                 :            : 
      99                 :          4 : TEST_F(ProperResponseTests, moveConstruction)
     100                 :            : {
     101         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse tmpValue(mValue);
     102                 :          1 :   ::ad::rss::state::ProperResponse value(std::move(tmpValue));
     103   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
     104                 :          1 : }
     105                 :            : 
     106                 :          4 : TEST_F(ProperResponseTests, copyAssignment)
     107                 :            : {
     108                 :          1 :   ::ad::rss::state::ProperResponse value;
     109         [ +  - ]:          1 :   value = mValue;
     110   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
     111                 :          1 : }
     112                 :            : 
     113                 :          4 : TEST_F(ProperResponseTests, moveAssignment)
     114                 :            : {
     115         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse tmpValue(mValue);
     116                 :          1 :   ::ad::rss::state::ProperResponse value;
     117                 :          1 :   value = std::move(tmpValue);
     118   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
     119                 :          1 : }
     120                 :            : 
     121                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorEqual)
     122                 :            : {
     123         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     124         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     125                 :            : 
     126   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     127   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     128                 :          1 : }
     129                 :            : 
     130                 :          4 : TEST_F(ProperResponseTests, stringConversionTest)
     131                 :            : {
     132         [ +  - ]:          1 :   std::stringstream stream;
     133         [ +  - ]:          1 :   stream << mValue;
     134         [ +  - ]:          1 :   std::string ostreamStr = stream.str();
     135         [ +  - ]:          1 :   std::string toStr = std::to_string(mValue);
     136   [ +  -  -  +  :          1 :   ASSERT_EQ(ostreamStr, toStr);
          -  -  -  -  -  
                -  +  - ]
     137   [ +  -  +  -  :          1 : }
                   +  - ]
     138                 :            : 
     139                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorTime_indexDiffers)
     140                 :            : {
     141         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     142                 :          1 :   ::ad::rss::world::TimeIndex time_index(std::numeric_limits<::ad::rss::world::TimeIndex>::max());
     143                 :          1 :   valueA.time_index = time_index;
     144         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     145                 :            : 
     146   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     147   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     148                 :          1 : }
     149                 :            : 
     150                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorIs_safeDiffers)
     151                 :            : {
     152         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     153                 :          1 :   bool is_safe{false};
     154                 :          1 :   valueA.is_safe = is_safe;
     155         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     156                 :            : 
     157   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     158   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     159                 :          1 : }
     160                 :            : 
     161                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorDangerous_objectsDiffers)
     162                 :            : {
     163         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     164                 :          1 :   ::ad::rss::world::ObjectIdVector dangerous_objects;
     165                 :          1 :   ::ad::rss::world::ObjectId dangerous_objectsElement(std::numeric_limits<::ad::rss::world::ObjectId>::max());
     166         [ +  - ]:          1 :   dangerous_objects.resize(0 + 1, dangerous_objectsElement);
     167         [ +  - ]:          1 :   valueA.dangerous_objects = dangerous_objects;
     168         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     169                 :            : 
     170   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     171   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     172                 :          1 : }
     173                 :            : 
     174                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorLongitudinal_responseDiffers)
     175                 :            : {
     176         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     177                 :          1 :   ::ad::rss::state::LongitudinalResponse longitudinal_response(::ad::rss::state::LongitudinalResponse::BrakeMin);
     178                 :          1 :   valueA.longitudinal_response = longitudinal_response;
     179         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     180                 :            : 
     181   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     182   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     183                 :          1 : }
     184                 :            : 
     185                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorLateral_response_rightDiffers)
     186                 :            : {
     187         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     188                 :          1 :   ::ad::rss::state::LateralResponse lateral_response_right(::ad::rss::state::LateralResponse::BrakeMin);
     189                 :          1 :   valueA.lateral_response_right = lateral_response_right;
     190         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     191                 :            : 
     192   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     193   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     194                 :          1 : }
     195                 :            : 
     196                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorLateral_response_leftDiffers)
     197                 :            : {
     198         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     199                 :          1 :   ::ad::rss::state::LateralResponse lateral_response_left(::ad::rss::state::LateralResponse::BrakeMin);
     200                 :          1 :   valueA.lateral_response_left = lateral_response_left;
     201         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     202                 :            : 
     203   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     204   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     205                 :          1 : }
     206                 :            : 
     207                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorHeading_rangesDiffers)
     208                 :            : {
     209         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     210                 :          1 :   ::ad::geometry::HeadingRangeVector heading_ranges;
     211                 :          1 :   ::ad::geometry::HeadingRange heading_rangesElement;
     212                 :          1 :   ::ad::physics::Angle heading_rangesElementBegin(6.283185308);
     213                 :          1 :   heading_rangesElement.begin = heading_rangesElementBegin;
     214                 :          1 :   ::ad::physics::Angle heading_rangesElementEnd(6.283185308);
     215                 :          1 :   heading_rangesElement.end = heading_rangesElementEnd;
     216         [ +  - ]:          1 :   heading_ranges.resize(2, heading_rangesElement);
     217         [ +  - ]:          1 :   valueA.heading_ranges = heading_ranges;
     218         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     219                 :            : 
     220   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     221   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     222                 :          1 : }
     223                 :            : 
     224                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorAcceleration_restrictionsDiffers)
     225                 :            : {
     226         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     227                 :          1 :   ::ad::rss::state::AccelerationRestriction acceleration_restrictions;
     228                 :          1 :   ::ad::physics::AccelerationRange acceleration_restrictionsLateral_left_range;
     229                 :          1 :   ::ad::physics::Acceleration acceleration_restrictionsLateral_left_rangeMinimum(1e2);
     230                 :          1 :   acceleration_restrictionsLateral_left_range.minimum = acceleration_restrictionsLateral_left_rangeMinimum;
     231                 :          1 :   ::ad::physics::Acceleration acceleration_restrictionsLateral_left_rangeMaximum(1e2);
     232                 :          1 :   acceleration_restrictionsLateral_left_range.maximum = acceleration_restrictionsLateral_left_rangeMaximum;
     233                 :          1 :   acceleration_restrictionsLateral_left_range.maximum = acceleration_restrictionsLateral_left_range.minimum;
     234                 :          1 :   acceleration_restrictionsLateral_left_range.minimum = acceleration_restrictionsLateral_left_range.maximum;
     235                 :          1 :   acceleration_restrictions.lateral_left_range = acceleration_restrictionsLateral_left_range;
     236                 :          1 :   ::ad::physics::AccelerationRange acceleration_restrictionsLongitudinal_range;
     237                 :          1 :   ::ad::physics::Acceleration acceleration_restrictionsLongitudinal_rangeMinimum(1e2);
     238                 :          1 :   acceleration_restrictionsLongitudinal_range.minimum = acceleration_restrictionsLongitudinal_rangeMinimum;
     239                 :          1 :   ::ad::physics::Acceleration acceleration_restrictionsLongitudinal_rangeMaximum(1e2);
     240                 :          1 :   acceleration_restrictionsLongitudinal_range.maximum = acceleration_restrictionsLongitudinal_rangeMaximum;
     241                 :          1 :   acceleration_restrictionsLongitudinal_range.maximum = acceleration_restrictionsLongitudinal_range.minimum;
     242                 :          1 :   acceleration_restrictionsLongitudinal_range.minimum = acceleration_restrictionsLongitudinal_range.maximum;
     243                 :          1 :   acceleration_restrictions.longitudinal_range = acceleration_restrictionsLongitudinal_range;
     244                 :          1 :   ::ad::physics::AccelerationRange acceleration_restrictionsLateral_right_range;
     245                 :          1 :   ::ad::physics::Acceleration acceleration_restrictionsLateral_right_rangeMinimum(1e2);
     246                 :          1 :   acceleration_restrictionsLateral_right_range.minimum = acceleration_restrictionsLateral_right_rangeMinimum;
     247                 :          1 :   ::ad::physics::Acceleration acceleration_restrictionsLateral_right_rangeMaximum(1e2);
     248                 :          1 :   acceleration_restrictionsLateral_right_range.maximum = acceleration_restrictionsLateral_right_rangeMaximum;
     249                 :          1 :   acceleration_restrictionsLateral_right_range.maximum = acceleration_restrictionsLateral_right_range.minimum;
     250                 :          1 :   acceleration_restrictionsLateral_right_range.minimum = acceleration_restrictionsLateral_right_range.maximum;
     251                 :          1 :   acceleration_restrictions.lateral_right_range = acceleration_restrictionsLateral_right_range;
     252                 :          1 :   valueA.acceleration_restrictions = acceleration_restrictions;
     253         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     254                 :            : 
     255   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     256   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     257                 :          1 : }
     258                 :            : 
     259                 :          4 : TEST_F(ProperResponseTests, comparisonOperatorUnstructured_constellation_responseDiffers)
     260                 :            : {
     261         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueA = mValue;
     262                 :          1 :   ::ad::rss::state::UnstructuredConstellationResponse unstructured_constellation_response(
     263                 :            :     ::ad::rss::state::UnstructuredConstellationResponse::Brake);
     264                 :          1 :   valueA.unstructured_constellation_response = unstructured_constellation_response;
     265         [ +  - ]:          1 :   ::ad::rss::state::ProperResponse valueB = mValue;
     266                 :            : 
     267   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     268   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     269                 :          1 : }
     270                 :            : 
     271                 :            : #if defined(__clang__) && (__clang_major__ >= 7)
     272                 :            : #pragma GCC diagnostic pop
     273                 :            : #endif

Generated by: LCOV version 1.14