LCOV - code coverage report
Current view: top level - tests/situation - RssFormulaTestsCalculateSafeLongitudinalDistanceSameDirection.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 11 11 100.0 %
Date: 2024-04-30 13:12:49 Functions: 4 4 100.0 %
Branches: 10 42 23.8 %

           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(RssFormulaTestsCalculateSafeLongitudinalDistanceSameDirection, negative_leading_speed)
      17                 :            : {
      18                 :          1 :   Distance safeDistance(0.);
      19                 :            : 
      20         [ +  - ]:          1 :   VehicleState leadingVehicle = createVehicleStateForLongitudinalMotion(-50);
      21         [ +  - ]:          1 :   VehicleState followingVehicle = createVehicleStateForLongitudinalMotion(50);
      22                 :            : 
      23   [ +  -  -  +  :          1 :   ASSERT_FALSE(calculateSafeLongitudinalDistanceSameDirection(leadingVehicle, followingVehicle, safeDistance));
          -  -  -  -  -  
                -  -  - ]
      24                 :            : }
      25                 :            : 
      26                 :          2 : TEST(RssFormulaTestsCalculateSafeLongitudinalDistanceSameDirection, checks_leading_vehicle_much_faster)
      27                 :            : {
      28                 :          1 :   Distance safeDistance(0.);
      29         [ +  - ]:          1 :   VehicleState leadingVehicle = createVehicleStateForLongitudinalMotion(100);
      30         [ +  - ]:          1 :   VehicleState followingVehicle = createVehicleStateForLongitudinalMotion(10);
      31                 :            : 
      32   [ +  -  -  +  :          1 :   ASSERT_TRUE(calculateSafeLongitudinalDistanceSameDirection(leadingVehicle, followingVehicle, safeDistance));
          -  -  -  -  -  
                -  -  - ]
      33                 :            : 
      34   [ +  -  -  +  :          1 :   ASSERT_NEAR(static_cast<double>(safeDistance), 0, cDoubleNear);
          -  -  -  -  -  
                      - ]
      35                 :            : }
      36                 :            : 
      37                 :            : } // namespace situation
      38                 :            : } // namespace rss
      39                 :            : } // namespace ad

Generated by: LCOV version 1.14