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

           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/SpeedValidInputRange.hpp"
      23                 :            : #include "ad/rss/world/Velocity.hpp"
      24                 :            : #include "spdlog/fmt/ostr.h"
      25                 :            : #include "spdlog/spdlog.h"
      26                 :            : 
      27                 :            : /*!
      28                 :            :  * \brief check if the given Velocity is within valid input range
      29                 :            :  *
      30                 :            :  * \param[in] input the Velocity as an input value
      31                 :            :  * \param[in] logErrors enables error logging
      32                 :            :  *
      33                 :            :  * \returns \c true if Velocity 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::Speed(0.) <= speedLonMin <= speedLonMax
      37                 :            :  *       speedLonMin <= speedLonMax <= ::ad::physics::Speed(100.)
      38                 :            :  *       ::ad::physics::Speed(-100.) <= speedLatMin <= speedLatMax
      39                 :            :  *       speedLatMin <= speedLatMax <= ::ad::physics::Speed(100.)
      40                 :            :  */
      41                 :      12084 : inline bool withinValidInputRange(::ad::rss::world::Velocity const &input, bool const logErrors = true)
      42                 :            : {
      43                 :            :   // check for generic member input ranges
      44                 :      12084 :   bool inValidInputRange = true;
      45                 :      12084 :   inValidInputRange = withinValidInputRange(input.speedLonMin, logErrors)
      46   [ +  +  +  + ]:      12079 :     && withinValidInputRange(input.speedLonMax, logErrors) && withinValidInputRange(input.speedLatMin, logErrors)
      47   [ +  +  +  + ]:      24163 :     && withinValidInputRange(input.speedLatMax, logErrors);
      48   [ +  +  +  - ]:      12084 :   if (!inValidInputRange && logErrors)
      49                 :            :   {
      50         [ +  - ]:         15 :     spdlog::error("withinValidInputRange(::ad::rss::world::Velocity)>> {} has invalid member",
      51                 :            :                   input); // LCOV_EXCL_BR_LINE
      52                 :            :   }
      53                 :            : 
      54                 :            :   // check for individual input ranges
      55         [ +  + ]:      12084 :   if (inValidInputRange)
      56                 :            :   {
      57   [ +  -  +  +  :      12069 :     inValidInputRange = (::ad::physics::Speed(0.) <= input.speedLonMin) && (input.speedLonMin <= input.speedLonMax);
             +  -  +  - ]
      58   [ +  +  +  - ]:      12069 :     if (!inValidInputRange && logErrors)
      59                 :            :     {
      60         [ +  - ]:          2 :       spdlog::error(
      61                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
      62                 :            :         input,
      63                 :          2 :         input.speedLonMin,
      64                 :          2 :         ::ad::physics::Speed(0.),
      65                 :          2 :         input.speedLonMax); // LCOV_EXCL_BR_LINE
      66                 :            :     }
      67                 :            :   }
      68                 :            : 
      69         [ +  + ]:      12084 :   if (inValidInputRange)
      70                 :            :   {
      71   [ +  -  +  -  :      12067 :     inValidInputRange = (input.speedLonMin <= input.speedLonMax) && (input.speedLonMax <= ::ad::physics::Speed(100.));
             +  -  +  - ]
      72   [ -  +  -  - ]:      12067 :     if (!inValidInputRange && logErrors)
      73                 :            :     {
      74         [ #  # ]:          0 :       spdlog::error(
      75                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
      76                 :            :         input,
      77                 :          0 :         input.speedLonMax,
      78                 :          0 :         input.speedLonMin,
      79                 :          0 :         ::ad::physics::Speed(100.)); // LCOV_EXCL_BR_LINE
      80                 :            :     }
      81                 :            :   }
      82                 :            : 
      83         [ +  + ]:      12084 :   if (inValidInputRange)
      84                 :            :   {
      85   [ +  -  +  -  :      12067 :     inValidInputRange = (::ad::physics::Speed(-100.) <= input.speedLatMin) && (input.speedLatMin <= input.speedLatMax);
             +  -  +  - ]
      86   [ -  +  -  - ]:      12067 :     if (!inValidInputRange && logErrors)
      87                 :            :     {
      88         [ #  # ]:          0 :       spdlog::error(
      89                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
      90                 :            :         input,
      91                 :          0 :         input.speedLatMin,
      92                 :          0 :         ::ad::physics::Speed(-100.),
      93                 :          0 :         input.speedLatMax); // LCOV_EXCL_BR_LINE
      94                 :            :     }
      95                 :            :   }
      96                 :            : 
      97         [ +  + ]:      12084 :   if (inValidInputRange)
      98                 :            :   {
      99   [ +  -  +  -  :      12067 :     inValidInputRange = (input.speedLatMin <= input.speedLatMax) && (input.speedLatMax <= ::ad::physics::Speed(100.));
             +  -  +  - ]
     100   [ -  +  -  - ]:      12067 :     if (!inValidInputRange && logErrors)
     101                 :            :     {
     102         [ #  # ]:          0 :       spdlog::error(
     103                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
     104                 :            :         input,
     105                 :          0 :         input.speedLatMax,
     106                 :          0 :         input.speedLatMin,
     107                 :          0 :         ::ad::physics::Speed(100.)); // LCOV_EXCL_BR_LINE
     108                 :            :     }
     109                 :            :   }
     110                 :            : 
     111                 :      12084 :   return inValidInputRange;
     112                 :            : }

Generated by: LCOV version 1.14