LCOV - code coverage report
Current view: top level - tests/generated/ad/rss/world - RoadSegmentTests.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 125 125 100.0 %
Date: 2025-07-22 06:53:46 Functions: 31 31 100.0 %
Branches: 57 224 25.4 %

           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/world/RoadSegment.hpp"
      23                 :            : 
      24                 :            : class RoadSegmentTests : public testing::Test
      25                 :            : {
      26                 :            : protected:
      27                 :         10 :   virtual void SetUp() override
      28                 :            :   {
      29                 :            :     // valid initialization
      30                 :         10 :     ::ad::rss::world::RoadSegment value;
      31                 :         10 :     ::ad::rss::world::RoadSegmentType valueType(::ad::rss::world::RoadSegmentType::Normal);
      32                 :         10 :     value.type = valueType;
      33                 :         10 :     ::ad::rss::world::LaneSegmentVector valueLane_segments;
      34                 :         10 :     ::ad::rss::world::LaneSegment valueLane_segmentsElement;
      35                 :         10 :     ::ad::rss::world::LaneSegmentId valueLane_segmentsElementId(
      36                 :            :       std::numeric_limits<::ad::rss::world::LaneSegmentId>::lowest());
      37                 :         10 :     valueLane_segmentsElement.id = valueLane_segmentsElementId;
      38                 :         10 :     ::ad::rss::world::LaneDrivingDirection valueLane_segmentsElementDriving_direction(
      39                 :            :       ::ad::rss::world::LaneDrivingDirection::Bidirectional);
      40                 :         10 :     valueLane_segmentsElement.driving_direction = valueLane_segmentsElementDriving_direction;
      41                 :         10 :     ::ad::physics::MetricRange valueLane_segmentsElementLength;
      42                 :         10 :     ::ad::physics::Distance valueLane_segmentsElementLengthMinimum(-1e9);
      43                 :         10 :     valueLane_segmentsElementLengthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct
      44                 :         10 :     valueLane_segmentsElementLength.minimum = valueLane_segmentsElementLengthMinimum;
      45                 :         10 :     ::ad::physics::Distance valueLane_segmentsElementLengthMaximum(-1e9);
      46                 :         10 :     valueLane_segmentsElementLength.maximum = valueLane_segmentsElementLengthMaximum;
      47                 :         10 :     valueLane_segmentsElementLength.maximum = valueLane_segmentsElementLength.minimum;
      48                 :         10 :     valueLane_segmentsElementLength.minimum = valueLane_segmentsElementLength.maximum;
      49                 :         10 :     valueLane_segmentsElement.length = valueLane_segmentsElementLength;
      50                 :         10 :     ::ad::physics::MetricRange valueLane_segmentsElementWidth;
      51                 :         10 :     ::ad::physics::Distance valueLane_segmentsElementWidthMinimum(-1e9);
      52                 :         10 :     valueLane_segmentsElementWidthMinimum = ::ad::physics::Distance(0.); // set to valid value within struct
      53                 :         10 :     valueLane_segmentsElementWidth.minimum = valueLane_segmentsElementWidthMinimum;
      54                 :         10 :     ::ad::physics::Distance valueLane_segmentsElementWidthMaximum(-1e9);
      55                 :         10 :     valueLane_segmentsElementWidth.maximum = valueLane_segmentsElementWidthMaximum;
      56                 :         10 :     valueLane_segmentsElementWidth.maximum = valueLane_segmentsElementWidth.minimum;
      57                 :         10 :     valueLane_segmentsElementWidth.minimum = valueLane_segmentsElementWidth.maximum;
      58                 :         10 :     valueLane_segmentsElement.width = valueLane_segmentsElementWidth;
      59         [ +  - ]:         10 :     valueLane_segments.resize(1, valueLane_segmentsElement);
      60         [ +  - ]:         10 :     value.lane_segments = valueLane_segments;
      61                 :         10 :     ::ad::physics::Distance valueMinimum_length_after_intersecting_area(-1e9);
      62                 :         10 :     value.minimum_length_after_intersecting_area = valueMinimum_length_after_intersecting_area;
      63                 :         10 :     ::ad::physics::Distance valueMinimum_length_before_intersecting_area(-1e9);
      64                 :         10 :     value.minimum_length_before_intersecting_area = valueMinimum_length_before_intersecting_area;
      65         [ +  - ]:         10 :     mValue = value;
      66                 :         10 :   }
      67                 :            : 
      68                 :            :   ::ad::rss::world::RoadSegment mValue;
      69                 :            : };
      70                 :            : 
      71                 :          4 : TEST_F(RoadSegmentTests, copyConstruction)
      72                 :            : {
      73         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment value(mValue);
      74   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      75                 :          1 : }
      76                 :            : 
      77                 :          4 : TEST_F(RoadSegmentTests, moveConstruction)
      78                 :            : {
      79         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment tmpValue(mValue);
      80                 :          1 :   ::ad::rss::world::RoadSegment value(std::move(tmpValue));
      81   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      82                 :          1 : }
      83                 :            : 
      84                 :          4 : TEST_F(RoadSegmentTests, copyAssignment)
      85                 :            : {
      86                 :          1 :   ::ad::rss::world::RoadSegment value;
      87         [ +  - ]:          1 :   value = mValue;
      88   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      89                 :          1 : }
      90                 :            : 
      91                 :          4 : TEST_F(RoadSegmentTests, moveAssignment)
      92                 :            : {
      93         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment tmpValue(mValue);
      94                 :          1 :   ::ad::rss::world::RoadSegment value;
      95                 :          1 :   value = std::move(tmpValue);
      96   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      97                 :          1 : }
      98                 :            : 
      99                 :          4 : TEST_F(RoadSegmentTests, comparisonOperatorEqual)
     100                 :            : {
     101         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueA = mValue;
     102         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueB = mValue;
     103                 :            : 
     104   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     105   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     106                 :          1 : }
     107                 :            : 
     108                 :          4 : TEST_F(RoadSegmentTests, stringConversionTest)
     109                 :            : {
     110         [ +  - ]:          1 :   std::stringstream stream;
     111         [ +  - ]:          1 :   stream << mValue;
     112         [ +  - ]:          1 :   std::string ostreamStr = stream.str();
     113         [ +  - ]:          1 :   std::string toStr = std::to_string(mValue);
     114   [ +  -  -  +  :          1 :   ASSERT_EQ(ostreamStr, toStr);
          -  -  -  -  -  
                -  +  - ]
     115   [ +  -  +  -  :          1 : }
                   +  - ]
     116                 :            : 
     117                 :          4 : TEST_F(RoadSegmentTests, comparisonOperatorTypeDiffers)
     118                 :            : {
     119         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueA = mValue;
     120                 :          1 :   ::ad::rss::world::RoadSegmentType type(::ad::rss::world::RoadSegmentType::Intersection);
     121                 :          1 :   valueA.type = type;
     122         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueB = mValue;
     123                 :            : 
     124   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     125   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     126                 :          1 : }
     127                 :            : 
     128                 :          4 : TEST_F(RoadSegmentTests, comparisonOperatorLane_segmentsDiffers)
     129                 :            : {
     130         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueA = mValue;
     131                 :          1 :   ::ad::rss::world::LaneSegmentVector lane_segments;
     132                 :          1 :   ::ad::rss::world::LaneSegment lane_segmentsElement;
     133                 :          1 :   ::ad::rss::world::LaneSegmentId lane_segmentsElementId(std::numeric_limits<::ad::rss::world::LaneSegmentId>::max());
     134                 :          1 :   lane_segmentsElement.id = lane_segmentsElementId;
     135                 :          1 :   ::ad::rss::world::LaneDrivingDirection lane_segmentsElementDriving_direction(
     136                 :            :     ::ad::rss::world::LaneDrivingDirection::Negative);
     137                 :          1 :   lane_segmentsElement.driving_direction = lane_segmentsElementDriving_direction;
     138                 :          1 :   ::ad::physics::MetricRange lane_segmentsElementLength;
     139                 :          1 :   ::ad::physics::Distance lane_segmentsElementLengthMinimum(1e9);
     140                 :          1 :   lane_segmentsElementLength.minimum = lane_segmentsElementLengthMinimum;
     141                 :          1 :   ::ad::physics::Distance lane_segmentsElementLengthMaximum(1e9);
     142                 :          1 :   lane_segmentsElementLengthMaximum = ::ad::physics::Distance(1e6); // set to valid value within struct
     143                 :          1 :   lane_segmentsElementLength.maximum = lane_segmentsElementLengthMaximum;
     144                 :          1 :   lane_segmentsElementLength.maximum = lane_segmentsElementLength.minimum;
     145                 :          1 :   lane_segmentsElementLength.minimum = lane_segmentsElementLength.maximum;
     146                 :          1 :   lane_segmentsElement.length = lane_segmentsElementLength;
     147                 :          1 :   ::ad::physics::MetricRange lane_segmentsElementWidth;
     148                 :          1 :   ::ad::physics::Distance lane_segmentsElementWidthMinimum(1e9);
     149                 :          1 :   lane_segmentsElementWidth.minimum = lane_segmentsElementWidthMinimum;
     150                 :          1 :   ::ad::physics::Distance lane_segmentsElementWidthMaximum(1e9);
     151                 :          1 :   lane_segmentsElementWidthMaximum = ::ad::physics::Distance(1e6); // set to valid value within struct
     152                 :          1 :   lane_segmentsElementWidth.maximum = lane_segmentsElementWidthMaximum;
     153                 :          1 :   lane_segmentsElementWidth.maximum = lane_segmentsElementWidth.minimum;
     154                 :          1 :   lane_segmentsElementWidth.minimum = lane_segmentsElementWidth.maximum;
     155                 :          1 :   lane_segmentsElement.width = lane_segmentsElementWidth;
     156         [ +  - ]:          1 :   lane_segments.resize(1 + 1, lane_segmentsElement);
     157         [ +  - ]:          1 :   valueA.lane_segments = lane_segments;
     158         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueB = mValue;
     159                 :            : 
     160   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     161   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     162                 :          1 : }
     163                 :            : 
     164                 :          4 : TEST_F(RoadSegmentTests, comparisonOperatorMinimum_length_after_intersecting_areaDiffers)
     165                 :            : {
     166         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueA = mValue;
     167                 :          1 :   ::ad::physics::Distance minimum_length_after_intersecting_area(1e9);
     168                 :          1 :   valueA.minimum_length_after_intersecting_area = minimum_length_after_intersecting_area;
     169         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueB = mValue;
     170                 :            : 
     171   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     172   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     173                 :          1 : }
     174                 :            : 
     175                 :          4 : TEST_F(RoadSegmentTests, comparisonOperatorMinimum_length_before_intersecting_areaDiffers)
     176                 :            : {
     177         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueA = mValue;
     178                 :          1 :   ::ad::physics::Distance minimum_length_before_intersecting_area(1e9);
     179                 :          1 :   valueA.minimum_length_before_intersecting_area = minimum_length_before_intersecting_area;
     180         [ +  - ]:          1 :   ::ad::rss::world::RoadSegment valueB = mValue;
     181                 :            : 
     182   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     183   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     184                 :          1 : }
     185                 :            : 
     186                 :            : #if defined(__clang__) && (__clang_major__ >= 7)
     187                 :            : #pragma GCC diagnostic pop
     188                 :            : #endif

Generated by: LCOV version 1.14