Skip to content
Snippets Groups Projects
Verified Commit 2c04a98c authored by Martin Stump's avatar Martin Stump
Browse files

Merge branch 'master' of...

Merge branch 'master' of https://gitlab.eclipse.org/eclipse/simopenpass/scenario_api into add-clang-tidy-config
parents b49fbdb5 0e80917f
No related tags found
No related merge requests found
......@@ -38,7 +38,9 @@ public:
virtual IVehicle& GetHost() = 0;
virtual std::optional<std::reference_wrapper<IEntity>> Get(const std::string& name) = 0;
virtual std::optional<std::reference_wrapper<const IEntity>> Get(const std::string& name) const = 0;
virtual std::optional<std::reference_wrapper<IEntity>> Get(UniqueId id) = 0;
virtual std::optional<std::reference_wrapper<const IEntity>> Get(UniqueId id) const = 0;
virtual bool Contains(UniqueId id) const = 0;
virtual void Delete(const std::string& name) = 0;
......
################################################################################
# Copyright (c) 2021 Daimler TSS GmbH
# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH
#
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License 2.0 which is available at
......@@ -8,4 +8,21 @@
# SPDX-License-Identifier: EPL-2.0
################################################################################
add_subdirectory(include)
CPMAddPackage(
NAME googletest
GITHUB_REPOSITORY google/googletest
GIT_TAG release-1.12.1
VERSION 1.12.1
OPTIONS "INSTALL_GTEST OFF" "gtest_force_shared_crt ON"
)
add_executable(MantleAPITest)
target_sources(MantleAPITest PUBLIC interface_test.cpp)
target_include_directories(MantleAPITest PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/test>)
target_link_libraries(MantleAPITest PUBLIC MantleAPI::MantleAPI GTest::gmock_main)
include(GoogleTest)
gtest_discover_tests(MantleAPITest)
......@@ -21,6 +21,7 @@
#include <MantleAPI/Execution/i_environment.h>
#include <MantleAPI/Map/i_coord_converter.h>
#include <MantleAPI/Map/i_lane_location_query_service.h>
#include <MantleAPI/Map/lane_definition.h>
#include <MantleAPI/Traffic/entity_properties.h>
#include <MantleAPI/Traffic/i_controller_config.h>
#include <MantleAPI/Traffic/i_controller_repository.h>
......@@ -150,7 +151,7 @@ public:
return pose;
}
std::optional<UniqueId> GetRelativeLaneId(const mantle_api::Pose& reference_pose_on_lane, int relative_lane_target) const override
std::optional<LaneId> GetRelativeLaneId(const mantle_api::Pose& reference_pose_on_lane, int relative_lane_target) const override
{
std::ignore = reference_pose_on_lane;
std::ignore = relative_lane_target;
......@@ -317,6 +318,12 @@ public:
(const std::string& name),
());
MOCK_METHOD(mantle_api::IEntity*,
GetImpl,
(const std::string& name),
(const));
std::optional<std::reference_wrapper<IEntity>> Get(const std::string& name) override
{
if (auto* entity = GetImpl(name))
......@@ -326,12 +333,27 @@ public:
return test_vehicle_;
}
std::optional<std::reference_wrapper<const IEntity>> Get(const std::string& name) const override
{
if (auto* entity = GetImpl(name))
{
return *entity;
}
return test_vehicle_;
}
std::optional<std::reference_wrapper<IEntity>> Get(mantle_api::UniqueId id) override
{
std::ignore = id;
return test_vehicle_;
}
std::optional<std::reference_wrapper<const IEntity>> Get(mantle_api::UniqueId id) const override
{
std::ignore = id;
return test_vehicle_;
}
mantle_api::IVehicle& GetHost() override { return test_vehicle_; }
const std::vector<std::unique_ptr<mantle_api::IEntity>>& GetEntities() const override { return entities_; }
......@@ -443,8 +465,12 @@ public:
mantle_api::IEntityRepository& GetEntityRepository() override { return entity_repository_; }
const mantle_api::IEntityRepository& GetEntityRepository() const override { return entity_repository_; }
MockControllerRepository& GetControllerRepository() override { return controller_repository_; }
const MockControllerRepository& GetControllerRepository() const override { return controller_repository_; }
void SetRoadCondition(std::vector<mantle_api::FrictionPatch> friction_patches) override
{
std::ignore = friction_patches;
......@@ -470,7 +496,6 @@ public:
(const std::string& name),
(override));
void SetDateTime(mantle_api::Time date_time) override { std::ignore = date_time; }
mantle_api::Time GetDateTime() override { return mantle_api::Time(); }
......@@ -482,6 +507,11 @@ public:
(mantle_api::DefaultRoutingBehavior default_routing_behavior),
(override));
MOCK_METHOD(void,
AssignRoute,
(mantle_api::UniqueId entity_id, mantle_api::RouteDefinition route_definition),
(override));
private:
MockQueryService query_service_{};
MockEntityRepository entity_repository_{};
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment