LCOV - code coverage report
Current view: top level - tests/generated/ad/rss/state - LateralResponseTests.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 22 22 100.0 %
Date: 2024-12-17 12:06:18 Functions: 6 6 100.0 %
Branches: 39 136 28.7 %

           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/LateralResponse.hpp"
      23                 :            : 
      24                 :          2 : TEST(LateralResponseTests, testFromString)
      25                 :            : {
      26   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::LateralResponse>("None"), ::ad::rss::state::LateralResponse::None);
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      27   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::LateralResponse>("::ad::rss::state::LateralResponse::None"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      28                 :            :             ::ad::rss::state::LateralResponse::None);
      29                 :            : 
      30   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::LateralResponse>("BrakeMin"), ::ad::rss::state::LateralResponse::BrakeMin);
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      31   [ +  -  +  -  :          1 :   ASSERT_EQ(fromString<::ad::rss::state::LateralResponse>("::ad::rss::state::LateralResponse::BrakeMin"),
          +  -  -  +  -  
             -  -  -  -  
                      - ]
      32                 :            :             ::ad::rss::state::LateralResponse::BrakeMin);
      33                 :            : 
      34   [ +  -  +  -  :          4 :   EXPECT_ANY_THROW({ fromString<::ad::rss::state::LateralResponse>("NOT A VALID ENUM LITERAL"); });
          +  -  +  -  -  
          +  -  +  -  -  
                   -  - ]
      35                 :            : }
      36                 :            : 
      37                 :          2 : TEST(LateralResponseTests, testToString)
      38                 :            : {
      39                 :          1 :   int32_t minValue = std::numeric_limits<int32_t>::max();
      40                 :          1 :   int32_t maxValue = std::numeric_limits<int32_t>::min();
      41                 :            : 
      42   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::LateralResponse::None), "::ad::rss::state::LateralResponse::None");
          -  +  -  -  -  
                -  -  - ]
      43                 :          1 :   minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::LateralResponse::None));
      44                 :          1 :   maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::LateralResponse::None));
      45                 :            : 
      46   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(::ad::rss::state::LateralResponse::BrakeMin), "::ad::rss::state::LateralResponse::BrakeMin");
          -  +  -  -  -  
                -  -  - ]
      47                 :          1 :   minValue = std::min(minValue, static_cast<int32_t>(::ad::rss::state::LateralResponse::BrakeMin));
      48                 :          1 :   maxValue = std::max(maxValue, static_cast<int32_t>(::ad::rss::state::LateralResponse::BrakeMin));
      49                 :            : 
      50   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(static_cast<::ad::rss::state::LateralResponse>(minValue - 1)), "UNKNOWN ENUM VALUE");
          -  +  -  -  -  
                -  -  - ]
      51   [ +  -  +  -  :          2 :   ASSERT_EQ(toString(static_cast<::ad::rss::state::LateralResponse>(maxValue + 1)), "UNKNOWN ENUM VALUE");
          -  +  -  -  -  
                -  -  - ]
      52                 :            : }
      53                 :            : 
      54                 :          2 : TEST(LateralResponseTests, ostreamOperatorTest)
      55                 :            : {
      56         [ +  - ]:          1 :   std::stringstream stream;
      57                 :          1 :   ::ad::rss::state::LateralResponse value(::ad::rss::state::LateralResponse::None);
      58         [ +  - ]:          1 :   stream << value;
      59   [ +  -  +  -  :          1 :   ASSERT_GT(stream.str().size(), 0u);
          -  +  -  -  -  
                -  -  - ]
      60                 :            : }
      61                 :            : 
      62                 :            : #if defined(__clang__) && (__clang_major__ >= 7)
      63                 :            : #pragma GCC diagnostic pop
      64                 :            : #endif

Generated by: LCOV version 1.14