LCOV - code coverage report
Current view: top level - tests/generated/ad/rss/state - RssStateEvaluatorTests.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 79 79 100.0 %
Date: 2024-12-17 12:06:18 Functions: 6 6 100.0 %
Branches: 138 496 27.8 %

           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/RssStateEvaluator.hpp"
      23                 :            : 
      24                 :          2 : TEST(RssStateEvaluatorTests, testFromString)
      25                 :            : {
      26   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("None"), ::ad::rss::state::RssStateEvaluator::None);
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      27   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("::ad::rss::state::RssStateEvaluator::None"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      28                 :            :             ::ad::rss::state::RssStateEvaluator::None);
      29                 :            : 
      30   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("LongitudinalDistanceOppositeDirectionEgoCorrectLane"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      31                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane);
      32   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      33                 :            :               "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane"),
      34                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane);
      35                 :            : 
      36   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("LongitudinalDistanceOppositeDirection"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      37                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection);
      38   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      39                 :            :               "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection"),
      40                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection);
      41                 :            : 
      42   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("LongitudinalDistanceSameDirectionEgoFront"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      43                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront);
      44   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      45                 :            :               "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront"),
      46                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront);
      47                 :            : 
      48   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("LongitudinalDistanceSameDirectionOtherInFront"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      49                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront);
      50   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      51                 :            :               "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront"),
      52                 :            :             ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront);
      53                 :            : 
      54   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("LateralDistance"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      55                 :            :             ::ad::rss::state::RssStateEvaluator::LateralDistance);
      56   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("::ad::rss::state::RssStateEvaluator::LateralDistance"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      57                 :            :             ::ad::rss::state::RssStateEvaluator::LateralDistance);
      58                 :            : 
      59   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("IntersectionOtherPriorityEgoAbleToStop"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      60                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop);
      61   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      62                 :            :               "::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop"),
      63                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop);
      64                 :            : 
      65   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("IntersectionEgoPriorityOtherAbleToStop"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      66                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop);
      67   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      68                 :            :               "::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop"),
      69                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop);
      70                 :            : 
      71   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("IntersectionEgoInFront"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      72                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionEgoInFront);
      73   [ +  -  +  -  :          1 :   ASSERT_EQ(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      74                 :            :     fromString<::ad::rss::state::RssStateEvaluator>("::ad::rss::state::RssStateEvaluator::IntersectionEgoInFront"),
      75                 :            :     ::ad::rss::state::RssStateEvaluator::IntersectionEgoInFront);
      76                 :            : 
      77   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("IntersectionOtherInFront"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      78                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionOtherInFront);
      79   [ +  -  +  -  :          1 :   ASSERT_EQ(
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      80                 :            :     fromString<::ad::rss::state::RssStateEvaluator>("::ad::rss::state::RssStateEvaluator::IntersectionOtherInFront"),
      81                 :            :     ::ad::rss::state::RssStateEvaluator::IntersectionOtherInFront);
      82                 :            : 
      83   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("IntersectionOverlap"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      84                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionOverlap);
      85   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::RssStateEvaluator>("::ad::rss::state::RssStateEvaluator::IntersectionOverlap"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      86                 :            :             ::ad::rss::state::RssStateEvaluator::IntersectionOverlap);
      87                 :            : 
      88   [ +  -  +  -  :          4 :   EXPECT_ANY_THROW({ fromString<::ad::rss::state::RssStateEvaluator>("NOT A VALID ENUM LITERAL"); });
          +  -  +  -  -  
          +  -  +  -  -  
                   -  - ]
      89                 :            : }
      90                 :            : 
      91                 :          2 : TEST(RssStateEvaluatorTests, testToString)
      92                 :            : {
      93                 :          1 :   int32_t minValue = std::numeric_limits<int32_t>::max();
      94                 :          1 :   int32_t maxValue = std::numeric_limits<int32_t>::min();
      95                 :            : 
      96   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::None), "::ad::rss::state::RssStateEvaluator::None");
          -  +  -  -  -  
                -  -  - ]
      97                 :          1 :   minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::None));
      98                 :          1 :   maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::None));
      99                 :            : 
     100   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane),
          -  +  -  -  -  
                -  -  - ]
     101                 :            :             "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane");
     102                 :          1 :   minValue = std::min(
     103                 :            :     minValue,
     104                 :          1 :     static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane));
     105                 :          1 :   maxValue = std::max(
     106                 :            :     maxValue,
     107                 :          1 :     static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane));
     108                 :            : 
     109   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection),
          -  +  -  -  -  
                -  -  - ]
     110                 :            :             "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection");
     111                 :          1 :   minValue = std::min(minValue,
     112                 :          1 :                       static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection));
     113                 :          1 :   maxValue = std::max(maxValue,
     114                 :          1 :                       static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection));
     115                 :            : 
     116   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront),
          -  +  -  -  -  
                -  -  - ]
     117                 :            :             "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront");
     118                 :          1 :   minValue = std::min(
     119                 :          1 :     minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront));
     120                 :          1 :   maxValue = std::max(
     121                 :          1 :     maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront));
     122                 :            : 
     123   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront),
          -  +  -  -  -  
                -  -  - ]
     124                 :            :             "::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront");
     125                 :          1 :   minValue = std::min(
     126                 :          1 :     minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront));
     127                 :          1 :   maxValue = std::max(
     128                 :          1 :     maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront));
     129                 :            : 
     130   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::LateralDistance),
          -  +  -  -  -  
                -  -  - ]
     131                 :            :             "::ad::rss::state::RssStateEvaluator::LateralDistance");
     132                 :          1 :   minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LateralDistance));
     133                 :          1 :   maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::LateralDistance));
     134                 :            : 
     135   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop),
          -  +  -  -  -  
                -  -  - ]
     136                 :            :             "::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop");
     137                 :          1 :   minValue = std::min(
     138                 :          1 :     minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop));
     139                 :          1 :   maxValue = std::max(
     140                 :          1 :     maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop));
     141                 :            : 
     142   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop),
          -  +  -  -  -  
                -  -  - ]
     143                 :            :             "::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop");
     144                 :          1 :   minValue = std::min(
     145                 :          1 :     minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop));
     146                 :          1 :   maxValue = std::max(
     147                 :          1 :     maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop));
     148                 :            : 
     149   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::IntersectionEgoInFront),
          -  +  -  -  -  
                -  -  - ]
     150                 :            :             "::ad::rss::state::RssStateEvaluator::IntersectionEgoInFront");
     151                 :          1 :   minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionEgoInFront));
     152                 :          1 :   maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionEgoInFront));
     153                 :            : 
     154   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::IntersectionOtherInFront),
          -  +  -  -  -  
                -  -  - ]
     155                 :            :             "::ad::rss::state::RssStateEvaluator::IntersectionOtherInFront");
     156                 :          1 :   minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionOtherInFront));
     157                 :          1 :   maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionOtherInFront));
     158                 :            : 
     159   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::RssStateEvaluator::IntersectionOverlap),
          -  +  -  -  -  
                -  -  - ]
     160                 :            :             "::ad::rss::state::RssStateEvaluator::IntersectionOverlap");
     161                 :          1 :   minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionOverlap));
     162                 :          1 :   maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::RssStateEvaluator::IntersectionOverlap));
     163                 :            : 
     164   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(static_cast<::ad::rss::state::RssStateEvaluator>(minValue - 1)), "UNKNOWN ENUM VALUE");
          -  +  -  -  -  
                -  -  - ]
     165   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(static_cast<::ad::rss::state::RssStateEvaluator>(maxValue + 1)), "UNKNOWN ENUM VALUE");
          -  +  -  -  -  
                -  -  - ]
     166                 :            : }
     167                 :            : 
     168                 :          2 : TEST(RssStateEvaluatorTests, ostreamOperatorTest)
     169                 :            : {
     170         [ +  - ]:          1 :   std::stringstream stream;
     171                 :          1 :   ::ad::rss::state::RssStateEvaluator value(::ad::rss::state::RssStateEvaluator::None);
     172         [ +  - ]:          1 :   stream << value;
     173   [ +  -  +  -  :          1 :   ASSERT_GT(stream.str().size(), 0u);
          -  +  -  -  -  
                -  -  - ]
     174                 :            : }
     175                 :            : 
     176                 :            : #if defined(__clang__) && (__clang_major__ >= 7)
     177                 :            : #pragma GCC diagnostic pop
     178                 :            : #endif

Generated by: LCOV version 1.14