LCOV - code coverage report
Current view: top level - tests/generated/ad/map/restriction - RestrictionsTests.cpp (source / functions) Hit Total Coverage
Test: ad_map_access Lines: 96 96 100.0 %
Date: 2022-10-04 09:48:07 Functions: 17 17 100.0 %
Branches: 53 184 28.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: MIT
       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/map/restriction/Restrictions.hpp"
      23                 :            : 
      24                 :            : class RestrictionsTests : public testing::Test
      25                 :            : {
      26                 :            : protected:
      27                 :          8 :   virtual void SetUp() override
      28                 :            :   {
      29                 :            :     // valid initialization
      30                 :         16 :     ::ad::map::restriction::Restrictions value;
      31                 :         16 :     ::ad::map::restriction::RestrictionList valueConjunctions;
      32                 :         16 :     ::ad::map::restriction::Restriction valueConjunctionsElement;
      33                 :          8 :     bool valueConjunctionsElementNegated{true};
      34                 :          8 :     valueConjunctionsElement.negated = valueConjunctionsElementNegated;
      35                 :         16 :     ::ad::map::restriction::RoadUserTypeList valueConjunctionsElementRoadUserTypes;
      36                 :          8 :     ::ad::map::restriction::RoadUserType valueConjunctionsElementRoadUserTypesElement(
      37                 :            :       ::ad::map::restriction::RoadUserType::INVALID);
      38         [ +  - ]:          8 :     valueConjunctionsElementRoadUserTypes.resize(1, valueConjunctionsElementRoadUserTypesElement);
      39         [ +  - ]:          8 :     valueConjunctionsElement.roadUserTypes = valueConjunctionsElementRoadUserTypes;
      40                 :          8 :     ::ad::map::restriction::PassengerCount valueConjunctionsElementPassengersMin(
      41                 :            :       std::numeric_limits<::ad::map::restriction::PassengerCount>::lowest());
      42                 :          8 :     valueConjunctionsElement.passengersMin = valueConjunctionsElementPassengersMin;
      43         [ +  - ]:          8 :     valueConjunctions.resize(1, valueConjunctionsElement);
      44         [ +  - ]:          8 :     value.conjunctions = valueConjunctions;
      45                 :         16 :     ::ad::map::restriction::RestrictionList valueDisjunctions;
      46                 :         16 :     ::ad::map::restriction::Restriction valueDisjunctionsElement;
      47                 :          8 :     bool valueDisjunctionsElementNegated{true};
      48                 :          8 :     valueDisjunctionsElement.negated = valueDisjunctionsElementNegated;
      49                 :         16 :     ::ad::map::restriction::RoadUserTypeList valueDisjunctionsElementRoadUserTypes;
      50                 :          8 :     ::ad::map::restriction::RoadUserType valueDisjunctionsElementRoadUserTypesElement(
      51                 :            :       ::ad::map::restriction::RoadUserType::INVALID);
      52         [ +  - ]:          8 :     valueDisjunctionsElementRoadUserTypes.resize(1, valueDisjunctionsElementRoadUserTypesElement);
      53         [ +  - ]:          8 :     valueDisjunctionsElement.roadUserTypes = valueDisjunctionsElementRoadUserTypes;
      54                 :          8 :     ::ad::map::restriction::PassengerCount valueDisjunctionsElementPassengersMin(
      55                 :            :       std::numeric_limits<::ad::map::restriction::PassengerCount>::lowest());
      56                 :          8 :     valueDisjunctionsElement.passengersMin = valueDisjunctionsElementPassengersMin;
      57         [ +  - ]:          8 :     valueDisjunctions.resize(1, valueDisjunctionsElement);
      58         [ +  - ]:          8 :     value.disjunctions = valueDisjunctions;
      59         [ +  - ]:          8 :     mValue = value;
      60                 :          8 :   }
      61                 :            : 
      62                 :            :   ::ad::map::restriction::Restrictions mValue;
      63                 :            : };
      64                 :            : 
      65                 :          2 : TEST_F(RestrictionsTests, copyConstruction)
      66                 :            : {
      67         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions value(mValue);
      68   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      69                 :          1 : }
      70                 :            : 
      71                 :          2 : TEST_F(RestrictionsTests, moveConstruction)
      72                 :            : {
      73         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions tmpValue(mValue);
      74                 :          2 :   ::ad::map::restriction::Restrictions value(std::move(tmpValue));
      75   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      76                 :          1 : }
      77                 :            : 
      78                 :          2 : TEST_F(RestrictionsTests, copyAssignment)
      79                 :            : {
      80                 :          2 :   ::ad::map::restriction::Restrictions value;
      81         [ +  - ]:          1 :   value = mValue;
      82   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      83                 :          1 : }
      84                 :            : 
      85                 :          2 : TEST_F(RestrictionsTests, moveAssignment)
      86                 :            : {
      87         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions tmpValue(mValue);
      88                 :          2 :   ::ad::map::restriction::Restrictions value;
      89                 :          1 :   value = std::move(tmpValue);
      90   [ +  -  -  +  :          1 :   EXPECT_EQ(mValue, value);
          -  -  -  -  -  
                      - ]
      91                 :          1 : }
      92                 :            : 
      93                 :          2 : TEST_F(RestrictionsTests, comparisonOperatorEqual)
      94                 :            : {
      95         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions valueA = mValue;
      96         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions valueB = mValue;
      97                 :            : 
      98   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
      99   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     100                 :          1 : }
     101                 :            : 
     102                 :          2 : TEST_F(RestrictionsTests, stringConversionTest)
     103                 :            : {
     104         [ +  - ]:          1 :   std::stringstream stream;
     105         [ +  - ]:          1 :   stream << mValue;
     106         [ +  - ]:          1 :   std::string ostreamStr = stream.str();
     107         [ +  - ]:          1 :   std::string toStr = std::to_string(mValue);
     108   [ +  -  -  +  :          1 :   ASSERT_EQ(ostreamStr, toStr);
          -  -  -  -  -  
                      - ]
     109                 :            : }
     110                 :            : 
     111                 :          2 : TEST_F(RestrictionsTests, comparisonOperatorConjunctionsDiffers)
     112                 :            : {
     113         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions valueA = mValue;
     114                 :          2 :   ::ad::map::restriction::RestrictionList conjunctions;
     115                 :          2 :   ::ad::map::restriction::Restriction conjunctionsElement;
     116                 :          1 :   bool conjunctionsElementNegated{false};
     117                 :          1 :   conjunctionsElement.negated = conjunctionsElementNegated;
     118                 :          2 :   ::ad::map::restriction::RoadUserTypeList conjunctionsElementRoadUserTypes;
     119                 :          1 :   ::ad::map::restriction::RoadUserType conjunctionsElementRoadUserTypesElement(
     120                 :            :     ::ad::map::restriction::RoadUserType::CAR_DIESEL);
     121         [ +  - ]:          1 :   conjunctionsElementRoadUserTypes.resize(2, conjunctionsElementRoadUserTypesElement);
     122         [ +  - ]:          1 :   conjunctionsElement.roadUserTypes = conjunctionsElementRoadUserTypes;
     123                 :          1 :   ::ad::map::restriction::PassengerCount conjunctionsElementPassengersMin(
     124                 :            :     std::numeric_limits<::ad::map::restriction::PassengerCount>::max());
     125                 :          1 :   conjunctionsElement.passengersMin = conjunctionsElementPassengersMin;
     126         [ +  - ]:          1 :   conjunctions.resize(2, conjunctionsElement);
     127         [ +  - ]:          1 :   valueA.conjunctions = conjunctions;
     128         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions valueB = mValue;
     129                 :            : 
     130   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     131   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     132                 :          1 : }
     133                 :            : 
     134                 :          2 : TEST_F(RestrictionsTests, comparisonOperatorDisjunctionsDiffers)
     135                 :            : {
     136         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions valueA = mValue;
     137                 :          2 :   ::ad::map::restriction::RestrictionList disjunctions;
     138                 :          2 :   ::ad::map::restriction::Restriction disjunctionsElement;
     139                 :          1 :   bool disjunctionsElementNegated{false};
     140                 :          1 :   disjunctionsElement.negated = disjunctionsElementNegated;
     141                 :          2 :   ::ad::map::restriction::RoadUserTypeList disjunctionsElementRoadUserTypes;
     142                 :          1 :   ::ad::map::restriction::RoadUserType disjunctionsElementRoadUserTypesElement(
     143                 :            :     ::ad::map::restriction::RoadUserType::CAR_DIESEL);
     144         [ +  - ]:          1 :   disjunctionsElementRoadUserTypes.resize(2, disjunctionsElementRoadUserTypesElement);
     145         [ +  - ]:          1 :   disjunctionsElement.roadUserTypes = disjunctionsElementRoadUserTypes;
     146                 :          1 :   ::ad::map::restriction::PassengerCount disjunctionsElementPassengersMin(
     147                 :            :     std::numeric_limits<::ad::map::restriction::PassengerCount>::max());
     148                 :          1 :   disjunctionsElement.passengersMin = disjunctionsElementPassengersMin;
     149         [ +  - ]:          1 :   disjunctions.resize(2, disjunctionsElement);
     150         [ +  - ]:          1 :   valueA.disjunctions = disjunctions;
     151         [ +  - ]:          2 :   ::ad::map::restriction::Restrictions valueB = mValue;
     152                 :            : 
     153   [ +  -  -  +  :          1 :   EXPECT_FALSE(valueA == valueB);
          -  -  -  -  -  
                -  -  - ]
     154   [ +  -  -  +  :          1 :   EXPECT_TRUE(valueA != valueB);
          -  -  -  -  -  
                -  -  - ]
     155                 :          1 : }
     156                 :            : 
     157                 :            : #if defined(__clang__) && (__clang_major__ >= 7)
     158                 :            : #pragma GCC diagnostic pop
     159                 :            : #endif

Generated by: LCOV version 1.14