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

Generated by: LCOV version 1.14