LCOV - code coverage report
Current view: top level - tests/src - RssWorldModelCreationTestTown04.cpp (source / functions) Hit Total Coverage
Test: ad_rss_map_integration Lines: 53 53 100.0 %
Date: 2025-07-22 06:56:19 Functions: 6 6 100.0 %
Branches: 55 184 29.9 %

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2019-2021 Intel Corporation
       4                 :            : //
       5                 :            : // SPDX-License-Identifier: LGPL-2.1-only
       6                 :            : //
       7                 :            : // ----------------- END LICENSE BLOCK -----------------------------------
       8                 :            : 
       9                 :            : #include <ad/rss/core/RssCheck.hpp>
      10                 :            : #include <ad/rss/map/test_support/RssWorldModelCreationTest.hpp>
      11                 :            : 
      12                 :            : struct RssWorldModelCreationTestTown04 : ad::rss::map::test_support::RssWorldModelCreationTest
      13                 :            : {
      14                 :          1 :   TestMode getTestMode() override
      15                 :            :   {
      16                 :          1 :     return TestMode::withRouteWithSpeedLimit;
      17                 :            :   }
      18                 :            : 
      19                 :          1 :   MapToLoad getMapToLoad() override
      20                 :            :   {
      21                 :          1 :     return MapToLoad::Town04;
      22                 :            :   }
      23                 :            : 
      24                 :          2 :   ObjectGeoLocationTuple createGeoLocationTuple(::ad::map::point::ENUCoordinate x,
      25                 :            :                                                 ::ad::map::point::ENUCoordinate y,
      26                 :            :                                                 ::ad::map::point::ENUHeading heading)
      27                 :            :   {
      28                 :          2 :     ::ad::map::point::ENUPoint egoENUPoint;
      29                 :          2 :     egoENUPoint.x = x;
      30                 :          2 :     egoENUPoint.y = y;
      31                 :          2 :     egoENUPoint.z = ::ad::map::point::ENUCoordinate(0);
      32         [ +  - ]:          2 :     auto egoGeoPoint = ::ad::map::point::toGeo(egoENUPoint);
      33         [ +  - ]:          2 :     auto egoGeoLocation = std::make_tuple(egoGeoPoint.longitude, egoGeoPoint.latitude, heading.mENUHeading);
      34                 :          4 :     return egoGeoLocation;
      35                 :            :   }
      36                 :            : 
      37                 :          1 :   ObjectGeoLocationTuple getEgoVehicleStartLocation() override
      38                 :            :   {
      39                 :            :     return createGeoLocationTuple(::ad::map::point::ENUCoordinate(131.074),
      40                 :            :                                   ::ad::map::point::ENUCoordinate(302.408),
      41         [ +  - ]:          1 :                                   ::ad::map::point::createENUHeading(0.346132));
      42                 :            :   }
      43                 :            : 
      44                 :          1 :   ::ad::map::point::GeoPoint getEgoVehicleTarget() override
      45                 :            :   {
      46                 :          1 :     ::ad::map::point::ENUPoint target;
      47                 :          1 :     target.x = ::ad::map::point::ENUCoordinate(240.0);
      48                 :          1 :     target.y = ::ad::map::point::ENUCoordinate(307.0);
      49                 :          1 :     target.z = ::ad::map::point::ENUCoordinate(0.0);
      50         [ +  - ]:          1 :     auto positionEndGeo = ::ad::map::point::toGeo(target);
      51                 :          2 :     return positionEndGeo;
      52                 :            :   }
      53                 :            : 
      54                 :            :   ::ad::rss::core::RssCheck rssCheck;
      55                 :            : };
      56                 :            : 
      57         [ +  - ]:          4 : TEST_F(RssWorldModelCreationTestTown04, testVehicleBehindConnectingRoute)
      58                 :            : {
      59   [ +  -  +  - ]:          1 :   ::ad::rss::map::RssWorldModelCreation constellationCreation(1u, mCheckerControlTest->getEgoVehicleDynamics());
      60                 :            : 
      61                 :            :   auto ego_vehicle
      62   [ +  -  +  -  :          1 :     = createEgoVehicle(::ad::rss::world::ObjectId(123), getEgoVehicleStartLocation(), getEgoVehicleTarget());
             +  -  +  - ]
      63         [ +  - ]:          1 :   auto const egoObjectData = ego_vehicle->getTestRssObjecData();
      64                 :            : 
      65         [ +  - ]:          1 :   spdlog::info("EgoMatchObject: {}", egoObjectData.match_object);
      66   [ +  -  +  - ]:          2 :   spdlog::info("EgoRoute: {}", ego_vehicle->mTestRoute);
      67                 :            : 
      68                 :            :   auto const otherLocation = createGeoLocationTuple(::ad::map::point::ENUCoordinate(124.568),
      69                 :            :                                                     ::ad::map::point::ENUCoordinate(299.829),
      70   [ +  -  +  - ]:          1 :                                                     ::ad::map::point::createENUHeading(0.419017));
      71         [ +  - ]:          1 :   auto otherVehicle = createOtherVehicle(::ad::rss::world::ObjectId(10), otherLocation);
      72         [ +  - ]:          1 :   auto const otherObjectData = otherVehicle->getTestRssObjecData();
      73                 :            : 
      74   [ +  -  -  +  :          1 :   EXPECT_TRUE(
          -  -  -  -  -  
                -  -  - ]
      75                 :            :     constellationCreation.appendConstellations(egoObjectData,
      76                 :            :                                                ego_vehicle->mTestRoute,
      77                 :            :                                                otherObjectData,
      78                 :            :                                                ::ad::rss::map::RssRestrictSpeedLimitMode::IncreasedSpeedLimit10,
      79                 :            :                                                ::ad::map::landmark::LandmarkIdSet(),
      80                 :          1 :                                                ::ad::rss::map::RssConstellationCreationMode::Structured));
      81                 :            : 
      82         [ +  - ]:          1 :   auto const world_model = constellationCreation.getWorldModel();
      83   [ +  -  -  +  :          1 :   EXPECT_TRUE(withinValidInputRange(world_model));
          -  -  -  -  -  
                -  -  - ]
      84                 :            : 
      85         [ +  - ]:          1 :   spdlog::info("WordModel: {}", world_model);
      86   [ +  -  -  +  :          1 :   ASSERT_EQ(world_model.constellations.size(), 1u);
          -  -  -  -  -  
                -  +  - ]
      87                 :            : 
      88                 :          1 :   ::ad::rss::state::ProperResponse routeResponse;
      89                 :          1 :   ::ad::rss::core::RssSituationSnapshot rss_situation_snapshot;
      90                 :          1 :   ::ad::rss::state::RssStateSnapshot stateSnapshot;
      91   [ +  -  -  +  :          1 :   EXPECT_TRUE(rssCheck.calculateProperResponse(world_model, rss_situation_snapshot, stateSnapshot, routeResponse));
          -  -  -  -  -  
                -  -  - ]
      92                 :            : 
      93                 :            :   // not safe, since the one behind us is far too near
      94   [ +  -  +  - ]:          1 :   spdlog::info("RouteResponse: {}", routeResponse);
      95   [ +  -  +  - ]:          1 :   spdlog::info("StateSnapshot: {}", stateSnapshot);
      96         [ +  - ]:          1 :   spdlog::info("ConstellationSnapshot: {}", rss_situation_snapshot);
      97   [ +  -  -  +  :          1 :   ASSERT_EQ(rss_situation_snapshot.constellations.size(), 1u);
          -  -  -  -  -  
                -  +  - ]
      98                 :            : 
      99   [ -  +  -  -  :          1 :   EXPECT_FALSE(routeResponse.is_safe);
          -  -  -  -  -  
                      - ]
     100   [ +  -  -  +  :          1 :   EXPECT_EQ(::ad::rss::core::LongitudinalRelativePosition::InFront,
          -  -  -  -  -  
                      - ]
     101                 :          1 :             rss_situation_snapshot.constellations.front().relative_position.longitudinal_position);
     102   [ +  -  -  +  :          1 :   EXPECT_EQ(::ad::rss::state::LongitudinalResponse::None, routeResponse.longitudinal_response);
          -  -  -  -  -  
                      - ]
     103   [ +  -  -  +  :          1 :   EXPECT_EQ(::ad::rss::core::LateralRelativePosition::OverlapLeft,
          -  -  -  -  -  
                      - ]
     104                 :          1 :             rss_situation_snapshot.constellations.front().relative_position.lateral_position);
     105   [ +  -  -  +  :          1 :   EXPECT_EQ(::ad::rss::state::LateralResponse::None, routeResponse.lateral_response_left);
          -  -  -  -  -  
                      - ]
     106   [ +  -  -  +  :          1 :   EXPECT_EQ(::ad::rss::state::LateralResponse::None, routeResponse.lateral_response_right);
          -  -  -  -  -  
                      - ]
     107   [ +  -  +  -  :          1 : }
          +  -  +  -  +  
                -  +  - ]

Generated by: LCOV version 1.14