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 : world::ConstellationType getConstellationType() override 18 : : { 19 : 204 : return world::ConstellationType::NotRelevant; 20 : : } 21 : : 22 : 51 : world::Object &getEgoObject() override 23 : : { 24 : 51 : return TESTBASE::objectOnSegment1; 25 : : } 26 : : 27 : 51 : world::Object &getConstellationObject(uint32_t) override 28 : : { 29 : 51 : return TESTBASE::objectOnSegment7; 30 : : } 31 : : }; 32 : : 33 : : using RssCheckNotRelevantTest = RssCheckNotRelevantTestBase<RssCheckTestBase>; 34 : : 35 : 4 : TEST_F(RssCheckNotRelevantTest, NotRelevant) 36 : : { 37 : 1 : worldModel.constellations[0].ego_vehicle.occupied_regions[0].segment_id = 8; 38 : : 39 : 1 : worldModel.constellations[0].object.occupied_regions[0].segment_id = 0; 40 : 1 : worldModel.constellations[0].constellation_type = world::ConstellationType::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.constellations[0].ego_vehicle.velocity.speed_lon_min = kmhToMeterPerSec(i); 48 : 100 : worldModel.constellations[0].ego_vehicle.velocity.speed_lon_max = kmhToMeterPerSec(i); 49 : 100 : worldModel.time_index++; 50 : : 51 [ + - - + : 100 : ASSERT_TRUE(rssCheck.calculateProperResponse(worldModel, properResponse)); - - - - - - - - + - ] 52 : : 53 [ + - ]: 100 : testRestrictions(properResponse.acceleration_restrictions); 54 : : } 55 [ + - + - ]: 1 : } 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