LCOV - code coverage report
Current view: top level - tests/generated/ad/rss/situation - RelativePositionTests.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 76 76 100.0 %
Date: 2024-04-16 14:13:10 Functions: 21 21 100.0 %
Branches: 34 178 19.1 %

           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/situation/RelativePosition.hpp"
      23                 :            : 
      24                 :            : class RelativePositionTests : public testing::Test
      25                 :            : {
      26                 :            : protected:
      27                 :         10 :   virtual void SetUp() override
      28                 :            :   {
      29                 :            :     // valid initialization
      30                 :         10 :     ::ad::rss::situation::RelativePosition value;
      31                 :         10 :     ::ad::rss::situation::LongitudinalRelativePosition valueLongitudinalPosition(
      32                 :            :       ::ad::rss::situation::LongitudinalRelativePosition::InFront);
      33                 :         10 :     value.longitudinalPosition = valueLongitudinalPosition;
      34                 :         10 :     ::ad::physics::Distance valueLongitudinalDistance(-1e9);
      35                 :         10 :     value.longitudinalDistance = valueLongitudinalDistance;
      36                 :         10 :     ::ad::rss::situation::LateralRelativePosition valueLateralPosition(
      37                 :            :       ::ad::rss::situation::LateralRelativePosition::AtLeft);
      38                 :         10 :     value.lateralPosition = valueLateralPosition;
      39                 :         10 :     ::ad::physics::Distance valueLateralDistance(-1e9);
      40                 :         10 :     value.lateralDistance = valueLateralDistance;
      41                 :         10 :     mValue = value;
      42                 :         10 :   }
      43                 :            : 
      44                 :            :   ::ad::rss::situation::RelativePosition mValue;
      45                 :            : };
      46                 :            : 
      47                 :          2 : TEST_F(RelativePositionTests, copyConstruction)
      48                 :            : {
      49                 :          1 :   ::ad::rss::situation::RelativePosition value(mValue);
      50   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      51                 :          1 : }
      52                 :            : 
      53                 :          2 : TEST_F(RelativePositionTests, moveConstruction)
      54                 :            : {
      55                 :          1 :   ::ad::rss::situation::RelativePosition tmpValue(mValue);
      56                 :          1 :   ::ad::rss::situation::RelativePosition value(std::move(tmpValue));
      57   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      58                 :          1 : }
      59                 :            : 
      60                 :          2 : TEST_F(RelativePositionTests, copyAssignment)
      61                 :            : {
      62                 :          1 :   ::ad::rss::situation::RelativePosition value;
      63                 :          1 :   value = mValue;
      64   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      65                 :          1 : }
      66                 :            : 
      67                 :          2 : TEST_F(RelativePositionTests, moveAssignment)
      68                 :            : {
      69                 :          1 :   ::ad::rss::situation::RelativePosition tmpValue(mValue);
      70                 :          1 :   ::ad::rss::situation::RelativePosition value;
      71                 :          1 :   value = std::move(tmpValue);
      72   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      73                 :          1 : }
      74                 :            : 
      75                 :          2 : TEST_F(RelativePositionTests, comparisonOperatorEqual)
      76                 :            : {
      77                 :          1 :   ::ad::rss::situation::RelativePosition valueA = mValue;
      78                 :          1 :   ::ad::rss::situation::RelativePosition valueB = mValue;
      79                 :            : 
      80   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
      81   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
      82                 :          1 : }
      83                 :            : 
      84                 :          2 : TEST_F(RelativePositionTests, stringConversionTest)
      85                 :            : {
      86         [ +  - ]:          1 :   std::stringstream stream;
      87         [ +  - ]:          1 :   stream << mValue;
      88         [ +  - ]:          1 :   std::string ostreamStr = stream.str();
      89         [ +  - ]:          1 :   std::string toStr = std::to_string(mValue);
      90   [ +  -  -  +  :          1 :   ASSERT_EQ(ostreamStr, toStr);
          -  -  -  -  -  
                      - ]
      91                 :            : }
      92                 :            : 
      93                 :          2 : TEST_F(RelativePositionTests, comparisonOperatorLongitudinalPositionDiffers)
      94                 :            : {
      95                 :          1 :   ::ad::rss::situation::RelativePosition valueA = mValue;
      96                 :          1 :   ::ad::rss::situation::LongitudinalRelativePosition longitudinalPosition(
      97                 :            :     ::ad::rss::situation::LongitudinalRelativePosition::AtBack);
      98                 :          1 :   valueA.longitudinalPosition = longitudinalPosition;
      99                 :          1 :   ::ad::rss::situation::RelativePosition valueB = mValue;
     100                 :            : 
     101   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     102   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     103                 :          1 : }
     104                 :            : 
     105                 :          2 : TEST_F(RelativePositionTests, comparisonOperatorLongitudinalDistanceDiffers)
     106                 :            : {
     107                 :          1 :   ::ad::rss::situation::RelativePosition valueA = mValue;
     108                 :          1 :   ::ad::physics::Distance longitudinalDistance(1e9);
     109                 :          1 :   valueA.longitudinalDistance = longitudinalDistance;
     110                 :          1 :   ::ad::rss::situation::RelativePosition valueB = mValue;
     111                 :            : 
     112   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     113   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     114                 :          1 : }
     115                 :            : 
     116                 :          2 : TEST_F(RelativePositionTests, comparisonOperatorLateralPositionDiffers)
     117                 :            : {
     118                 :          1 :   ::ad::rss::situation::RelativePosition valueA = mValue;
     119                 :          1 :   ::ad::rss::situation::LateralRelativePosition lateralPosition(::ad::rss::situation::LateralRelativePosition::AtRight);
     120                 :          1 :   valueA.lateralPosition = lateralPosition;
     121                 :          1 :   ::ad::rss::situation::RelativePosition valueB = mValue;
     122                 :            : 
     123   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     124   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     125                 :          1 : }
     126                 :            : 
     127                 :          2 : TEST_F(RelativePositionTests, comparisonOperatorLateralDistanceDiffers)
     128                 :            : {
     129                 :          1 :   ::ad::rss::situation::RelativePosition valueA = mValue;
     130                 :          1 :   ::ad::physics::Distance lateralDistance(1e9);
     131                 :          1 :   valueA.lateralDistance = lateralDistance;
     132                 :          1 :   ::ad::rss::situation::RelativePosition valueB = mValue;
     133                 :            : 
     134   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     135   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     136                 :          1 : }
     137                 :            : 
     138                 :            : #if defined(__clang__) && (__clang_major__ >= 7)
     139                 :            : #pragma GCC diagnostic pop
     140                 :            : #endif

Generated by: LCOV version 1.14