LCOV - code coverage report
Current view: top level - generated/include/ad/rss/world - LongitudinalRssAccelerationValuesValidInputRange.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 36 36 100.0 %
Date: 2024-04-30 13:12:49 Functions: 1 1 100.0 %
Branches: 54 74 73.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
       3                 :            :  *
       4                 :            :  * Copyright (C) 2018-2020 Intel Corporation
       5                 :            :  *
       6                 :            :  * SPDX-License-Identifier: LGPL-2.1-only
       7                 :            :  *
       8                 :            :  * ----------------- END LICENSE BLOCK -----------------------------------
       9                 :            :  */
      10                 :            : 
      11                 :            : /**
      12                 :            :  * Generated file
      13                 :            :  * @file
      14                 :            :  *
      15                 :            :  * Generator Version : 11.0.0-1997
      16                 :            :  */
      17                 :            : 
      18                 :            : #pragma once
      19                 :            : 
      20                 :            : #include <cmath>
      21                 :            : #include <limits>
      22                 :            : #include "ad/physics/AccelerationValidInputRange.hpp"
      23                 :            : #include "ad/rss/world/LongitudinalRssAccelerationValues.hpp"
      24                 :            : #include "spdlog/fmt/ostr.h"
      25                 :            : #include "spdlog/spdlog.h"
      26                 :            : 
      27                 :            : /*!
      28                 :            :  * \brief check if the given LongitudinalRssAccelerationValues is within valid input range
      29                 :            :  *
      30                 :            :  * \param[in] input the LongitudinalRssAccelerationValues as an input value
      31                 :            :  * \param[in] logErrors enables error logging
      32                 :            :  *
      33                 :            :  * \returns \c true if LongitudinalRssAccelerationValues is considered to be within the specified input range
      34                 :            :  *
      35                 :            :  * \note the specified input range is defined by the ranges of all members, plus:
      36                 :            :  *       ::ad::physics::Acceleration(0.) <= accelMax <= ::ad::physics::Acceleration(1e2)
      37                 :            :  *       ::ad::physics::Acceleration(-1e2) <= brakeMax <= brakeMin
      38                 :            :  *       brakeMax <= brakeMin <= brakeMinCorrect
      39                 :            :  *       brakeMin <= brakeMinCorrect < ::ad::physics::Acceleration(0.)
      40                 :            :  */
      41                 :     280949 : inline bool withinValidInputRange(::ad::rss::world::LongitudinalRssAccelerationValues const &input,
      42                 :            :                                   bool const logErrors = true)
      43                 :            : {
      44                 :            :   // check for generic member input ranges
      45                 :     280949 :   bool inValidInputRange = true;
      46                 :     280949 :   inValidInputRange = withinValidInputRange(input.accelMax, logErrors)
      47   [ +  +  +  + ]:     280927 :     && withinValidInputRange(input.brakeMax, logErrors) && withinValidInputRange(input.brakeMin, logErrors)
      48   [ +  +  +  + ]:     561876 :     && withinValidInputRange(input.brakeMinCorrect, logErrors);
      49   [ +  +  +  - ]:     280949 :   if (!inValidInputRange && logErrors)
      50                 :            :   {
      51         [ +  - ]:         31 :     spdlog::error("withinValidInputRange(::ad::rss::world::LongitudinalRssAccelerationValues)>> {} has invalid member",
      52                 :            :                   input); // LCOV_EXCL_BR_LINE
      53                 :            :   }
      54                 :            : 
      55                 :            :   // check for individual input ranges
      56         [ +  + ]:     280949 :   if (inValidInputRange)
      57                 :            :   {
      58                 :            :     inValidInputRange
      59   [ +  -  +  +  :     280918 :       = (::ad::physics::Acceleration(0.) <= input.accelMax) && (input.accelMax <= ::ad::physics::Acceleration(1e2));
             +  -  +  - ]
      60   [ +  +  +  - ]:     280918 :     if (!inValidInputRange && logErrors)
      61                 :            :     {
      62         [ +  - ]:       2000 :       spdlog::error("withinValidInputRange(::ad::rss::world::LongitudinalRssAccelerationValues)>> {} element {} out of "
      63                 :            :                     "valid input range [{}, {}]",
      64                 :            :                     input,
      65                 :       2000 :                     input.accelMax,
      66                 :       2000 :                     ::ad::physics::Acceleration(0.),
      67                 :       4000 :                     ::ad::physics::Acceleration(1e2)); // LCOV_EXCL_BR_LINE
      68                 :            :     }
      69                 :            :   }
      70                 :            : 
      71         [ +  + ]:     280949 :   if (inValidInputRange)
      72                 :            :   {
      73   [ +  -  +  -  :     278918 :     inValidInputRange = (::ad::physics::Acceleration(-1e2) <= input.brakeMax) && (input.brakeMax <= input.brakeMin);
             +  -  +  + ]
      74   [ +  +  +  - ]:     278918 :     if (!inValidInputRange && logErrors)
      75                 :            :     {
      76         [ +  - ]:       2002 :       spdlog::error("withinValidInputRange(::ad::rss::world::LongitudinalRssAccelerationValues)>> {} element {} out of "
      77                 :            :                     "valid input range [{}, {}]",
      78                 :            :                     input,
      79                 :       2002 :                     input.brakeMax,
      80                 :       2002 :                     ::ad::physics::Acceleration(-1e2),
      81                 :       2002 :                     input.brakeMin); // LCOV_EXCL_BR_LINE
      82                 :            :     }
      83                 :            :   }
      84                 :            : 
      85         [ +  + ]:     280949 :   if (inValidInputRange)
      86                 :            :   {
      87   [ +  -  +  + ]:     276916 :     inValidInputRange = (input.brakeMax <= input.brakeMin) && (input.brakeMin <= input.brakeMinCorrect);
      88   [ +  +  +  - ]:     276916 :     if (!inValidInputRange && logErrors)
      89                 :            :     {
      90         [ +  - ]:       2005 :       spdlog::error("withinValidInputRange(::ad::rss::world::LongitudinalRssAccelerationValues)>> {} element {} out of "
      91                 :            :                     "valid input range [{}, {}]",
      92                 :            :                     input,
      93                 :       2005 :                     input.brakeMin,
      94                 :       2005 :                     input.brakeMax,
      95                 :       2005 :                     input.brakeMinCorrect); // LCOV_EXCL_BR_LINE
      96                 :            :     }
      97                 :            :   }
      98                 :            : 
      99         [ +  + ]:     280949 :   if (inValidInputRange)
     100                 :            :   {
     101                 :            :     inValidInputRange
     102   [ +  -  +  -  :     274911 :       = (input.brakeMin <= input.brakeMinCorrect) && (input.brakeMinCorrect < ::ad::physics::Acceleration(0.));
             +  -  +  + ]
     103   [ +  +  +  - ]:     274911 :     if (!inValidInputRange && logErrors)
     104                 :            :     {
     105         [ +  - ]:       2004 :       spdlog::error("withinValidInputRange(::ad::rss::world::LongitudinalRssAccelerationValues)>> {} element {} out of "
     106                 :            :                     "valid input range [{}, {}]",
     107                 :            :                     input,
     108                 :       2004 :                     input.brakeMinCorrect,
     109                 :       2004 :                     input.brakeMin,
     110                 :       4008 :                     ::ad::physics::Acceleration(0.)); // LCOV_EXCL_BR_LINE
     111                 :            :     }
     112                 :            :   }
     113                 :            : 
     114                 :     280949 :   return inValidInputRange;
     115                 :            : }

Generated by: LCOV version 1.14