LCOV - code coverage report
Current view: top level - tests/core - RssCheckNotRelevantTests.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 22 22 100.0 %
Date: 2024-04-16 14:13:10 Functions: 13 13 100.0 %
Branches: 13 36 36.1 %

           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 "RssCheckTestBaseT.hpp"
      10                 :            : 
      11                 :            : namespace ad {
      12                 :            : namespace rss {
      13                 :            : namespace core {
      14                 :            : 
      15                 :            : template <class TESTBASE> class RssCheckNotRelevantTestBase : public TESTBASE
      16                 :            : {
      17                 :        204 :   situation::SituationType getSituationType() override
      18                 :            :   {
      19                 :        204 :     return situation::SituationType::NotRelevant;
      20                 :            :   }
      21                 :            : 
      22                 :         51 :   world::Object &getEgoObject() override
      23                 :            :   {
      24                 :         51 :     return TESTBASE::objectOnSegment1;
      25                 :            :   }
      26                 :            : 
      27                 :         51 :   world::Object &getSceneObject(uint32_t) override
      28                 :            :   {
      29                 :         51 :     return TESTBASE::objectOnSegment7;
      30                 :            :   }
      31                 :            : };
      32                 :            : 
      33                 :            : using RssCheckNotRelevantTest = RssCheckNotRelevantTestBase<RssCheckTestBase>;
      34                 :            : 
      35                 :          2 : TEST_F(RssCheckNotRelevantTest, NotRelevant)
      36                 :            : {
      37                 :          1 :   worldModel.scenes[0].egoVehicle.occupiedRegions[0].segmentId = 8;
      38                 :            : 
      39                 :          1 :   worldModel.scenes[0].object.occupiedRegions[0].segmentId = 0;
      40                 :          1 :   worldModel.scenes[0].situationType = situation::SituationType::NotRelevant;
      41                 :            : 
      42                 :          1 :   state::ProperResponse properResponse;
      43         [ +  - ]:          1 :   core::RssCheck rssCheck;
      44                 :            : 
      45         [ +  + ]:        101 :   for (uint32_t i = 0; i < 100; i++)
      46                 :            :   {
      47                 :        100 :     worldModel.scenes[0].egoVehicle.velocity.speedLonMin = kmhToMeterPerSec(i);
      48                 :        100 :     worldModel.scenes[0].egoVehicle.velocity.speedLonMax = kmhToMeterPerSec(i);
      49                 :        100 :     worldModel.timeIndex++;
      50                 :            : 
      51   [ +  -  -  +  :        100 :     ASSERT_TRUE(rssCheck.calculateProperResponse(worldModel, properResponse));
          -  -  -  -  -  
                -  -  - ]
      52                 :            : 
      53         [ +  - ]:        100 :     testRestrictions(properResponse.accelerationRestrictions);
      54                 :            :   }
      55                 :            : }
      56                 :            : 
      57                 :            : using RssCheckNotRelevantOutOfMemoryTest = RssCheckNotRelevantTestBase<RssCheckOutOfMemoryTestBase>;
      58   [ +  -  +  -  :        101 : TEST_P(RssCheckNotRelevantOutOfMemoryTest, outOfMemoryAnyTime)
          +  -  +  -  +  
                      - ]
      59                 :            : {
      60         [ +  - ]:         50 :   performOutOfMemoryTest();
      61                 :         50 : }
      62   [ -  +  -  -  :         51 : INSTANTIATE_TEST_CASE_P(Range, RssCheckNotRelevantOutOfMemoryTest, ::testing::Range(uint64_t(0u), uint64_t(50u), 1u));
                   -  - ]
      63                 :            : 
      64                 :            : } // namespace core
      65                 :            : } // namespace rss
      66                 :            : } // namespace ad

Generated by: LCOV version 1.14