LCOV - code coverage report
Current view: top level - generated/include/ad/physics - SpeedRangeValidInputRange.hpp (source / functions) Hit Total Coverage
Test: ad_physics Lines: 12 20 60.0 %
Date: 2022-10-04 09:47:07 Functions: 1 1 100.0 %
Branches: 22 42 52.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: MIT
       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/SpeedRange.hpp"
      23                 :            : #include "ad/physics/SpeedValidInputRange.hpp"
      24                 :            : #include "spdlog/fmt/ostr.h"
      25                 :            : #include "spdlog/spdlog.h"
      26                 :            : 
      27                 :            : /*!
      28                 :            :  * \brief check if the given SpeedRange is within valid input range
      29                 :            :  *
      30                 :            :  * \param[in] input the SpeedRange as an input value
      31                 :            :  * \param[in] logErrors enables error logging
      32                 :            :  *
      33                 :            :  * \returns \c true if SpeedRange 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(-100.) <= minimum <= maximum
      37                 :            :  *       minimum <= maximum <= ::ad::physics::Speed(100.)
      38                 :            :  */
      39                 :          9 : inline bool withinValidInputRange(::ad::physics::SpeedRange const &input, bool const logErrors = true)
      40                 :            : {
      41                 :            :   // check for generic member input ranges
      42                 :          9 :   bool inValidInputRange = true;
      43                 :            :   inValidInputRange
      44   [ +  +  +  + ]:          9 :     = withinValidInputRange(input.minimum, logErrors) && withinValidInputRange(input.maximum, logErrors);
      45   [ +  +  +  - ]:          9 :   if (!inValidInputRange && logErrors)
      46                 :            :   {
      47         [ +  - ]:          7 :     spdlog::error("withinValidInputRange(::ad::physics::SpeedRange)>> {} has invalid member",
      48                 :            :                   input); // LCOV_EXCL_BR_LINE
      49                 :            :   }
      50                 :            : 
      51                 :            :   // check for individual input ranges
      52         [ +  + ]:          9 :   if (inValidInputRange)
      53                 :            :   {
      54   [ +  -  +  -  :          2 :     inValidInputRange = (::ad::physics::Speed(-100.) <= input.minimum) && (input.minimum <= input.maximum);
             +  -  +  - ]
      55   [ -  +  -  - ]:          2 :     if (!inValidInputRange && logErrors)
      56                 :            :     {
      57         [ #  # ]:          0 :       spdlog::error(
      58                 :            :         "withinValidInputRange(::ad::physics::SpeedRange)>> {} element {} out of valid input range [{}, {}]",
      59                 :            :         input,
      60                 :          0 :         input.minimum,
      61                 :          0 :         ::ad::physics::Speed(-100.),
      62                 :          0 :         input.maximum); // LCOV_EXCL_BR_LINE
      63                 :            :     }
      64                 :            :   }
      65                 :            : 
      66         [ +  + ]:          9 :   if (inValidInputRange)
      67                 :            :   {
      68   [ +  -  +  -  :          2 :     inValidInputRange = (input.minimum <= input.maximum) && (input.maximum <= ::ad::physics::Speed(100.));
             +  -  +  - ]
      69   [ -  +  -  - ]:          2 :     if (!inValidInputRange && logErrors)
      70                 :            :     {
      71         [ #  # ]:          0 :       spdlog::error(
      72                 :            :         "withinValidInputRange(::ad::physics::SpeedRange)>> {} element {} out of valid input range [{}, {}]",
      73                 :            :         input,
      74                 :          0 :         input.maximum,
      75                 :          0 :         input.minimum,
      76                 :          0 :         ::ad::physics::Speed(100.)); // LCOV_EXCL_BR_LINE
      77                 :            :     }
      78                 :            :   }
      79                 :            : 
      80                 :          9 :   return inValidInputRange;
      81                 :            : }

Generated by: LCOV version 1.14