LCOV - code coverage report
Current view: top level - tests/situation - RssFormulaTestsInputRangeChecks.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 34 34 100.0 %
Date: 2024-04-30 13:12:49 Functions: 10 10 100.0 %
Branches: 21 90 23.3 %

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2018-2021 Intel Corporation
       4                 :            : //
       5                 :            : // SPDX-License-Identifier: LGPL-2.1-only
       6                 :            : //
       7                 :            : // ----------------- END LICENSE BLOCK -----------------------------------
       8                 :            : 
       9                 :            : #include "TestSupport.hpp"
      10                 :            : #include "ad/rss/situation/RssFormulas.hpp"
      11                 :            : 
      12                 :            : namespace ad {
      13                 :            : namespace rss {
      14                 :            : namespace situation {
      15                 :            : 
      16                 :          2 : TEST(RssFormulaTestsInputRangeChecks, checkSafeLongitudinalDistanceSameDirection)
      17                 :            : {
      18                 :          1 :   bool isSafe = false;
      19                 :          1 :   Distance vehicleDistance(-1.);
      20                 :          1 :   Distance safeDistance(0);
      21         [ +  - ]:          1 :   VehicleState leadingVehicle = createVehicleStateForLongitudinalMotion(10);
      22         [ +  - ]:          1 :   VehicleState followingVehicle = createVehicleStateForLongitudinalMotion(10);
      23                 :            : 
      24   [ +  -  -  +  :          1 :   ASSERT_FALSE(checkSafeLongitudinalDistanceSameDirection(
          -  -  -  -  -  
                -  -  - ]
      25                 :            :     leadingVehicle, followingVehicle, vehicleDistance, safeDistance, isSafe));
      26                 :            : }
      27                 :            : 
      28                 :          2 : TEST(RssFormulaTestsInputRangeChecks, checkSafeLongitudinalDistanceOppositeDirection)
      29                 :            : {
      30                 :          1 :   bool isSafe = false;
      31                 :          1 :   Distance vehicleDistance(-1.);
      32                 :          1 :   Distance safeDistance(0);
      33         [ +  - ]:          1 :   VehicleState correctVehicle = createVehicleStateForLongitudinalMotion(50);
      34         [ +  - ]:          1 :   VehicleState oppositeVehicle = createVehicleStateForLongitudinalMotion(-50);
      35                 :            : 
      36   [ +  -  -  +  :          1 :   ASSERT_FALSE(checkSafeLongitudinalDistanceOppositeDirection(
          -  -  -  -  -  
                -  -  - ]
      37                 :            :     correctVehicle, oppositeVehicle, vehicleDistance, safeDistance, isSafe));
      38                 :            : }
      39                 :            : 
      40                 :          2 : TEST(RssFormulaTestsInputRangeChecks, checkSafeLateralDistance)
      41                 :            : {
      42                 :          1 :   bool isSafe = false;
      43                 :          1 :   Distance vehicleDistance(-1.);
      44                 :          1 :   Distance safeDistance(0);
      45         [ +  - ]:          1 :   VehicleState leftVehicle = createVehicleStateForLongitudinalMotion(50);
      46         [ +  - ]:          1 :   VehicleState rightVehicle = createVehicleStateForLongitudinalMotion(50);
      47                 :            : 
      48   [ +  -  -  +  :          1 :   ASSERT_FALSE(checkSafeLateralDistance(leftVehicle, rightVehicle, vehicleDistance, safeDistance, isSafe));
          -  -  -  -  -  
                -  -  - ]
      49                 :            : }
      50                 :            : 
      51                 :          2 : TEST(RssFormulaTestsInputRangeChecks, calculateSafeLongitudinalDistanceOppositeDirection)
      52                 :            : {
      53                 :          1 :   Distance safeDistance(0.);
      54                 :            : 
      55         [ +  - ]:          1 :   VehicleState correctVehicle = createVehicleStateForLongitudinalMotion(50);
      56         [ +  - ]:          1 :   VehicleState oppositeVehicle = createVehicleStateForLongitudinalMotion(-50);
      57                 :          1 :   correctVehicle.dynamics.responseTime = Duration(-1);
      58   [ +  -  -  +  :          1 :   ASSERT_FALSE(calculateSafeLongitudinalDistanceOppositeDirection(correctVehicle, oppositeVehicle, safeDistance));
          -  -  -  -  -  
                -  -  - ]
      59   [ +  -  -  +  :          1 :   ASSERT_FALSE(calculateSafeLongitudinalDistanceOppositeDirection(oppositeVehicle, correctVehicle, safeDistance));
          -  -  -  -  -  
                -  -  - ]
      60                 :            : }
      61                 :            : 
      62                 :          2 : TEST(RssFormulaTestsInputRangeChecks, checkStopInFrontIntersection)
      63                 :            : {
      64                 :          1 :   bool isSafe = false;
      65                 :          1 :   Distance safeDistance(0.);
      66         [ +  - ]:          1 :   VehicleState correctVehicle = createVehicleStateForLongitudinalMotion(50);
      67                 :          1 :   correctVehicle.dynamics.responseTime = Duration(-1);
      68   [ +  -  -  +  :          1 :   ASSERT_FALSE(checkStopInFrontIntersection(correctVehicle, safeDistance, isSafe));
          -  -  -  -  -  
                -  -  - ]
      69                 :            : }
      70                 :            : 
      71                 :            : } // namespace situation
      72                 :            : } // namespace rss
      73                 :            : } // namespace ad

Generated by: LCOV version 1.14