Files
comaps/routing_common/routing_common_tests/bicycle_model_test.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

43 lines
1.0 KiB
C++

#include "testing/testing.hpp"
#include "routing_common/bicycle_model.hpp"
#include "indexer/classificator.hpp"
#include "indexer/classificator_loader.hpp"
#include "indexer/feature_data.hpp"
namespace bicycle_model_test
{
using namespace routing;
class BicycleModelTest
{
public:
BicycleModelTest() { classificator::Load(); }
std::shared_ptr<VehicleModel> GetModel(std::string const & country)
{
return std::dynamic_pointer_cast<VehicleModel>(BicycleModelFactory().GetVehicleModelForCountry(country));
}
SpeedParams DefaultSpeedParams()
{
return {true /* forward */, true /* isCity */, Maxspeed()};
}
};
UNIT_CLASS_TEST(BicycleModelTest, Turkey)
{
auto const model = GetModel("Turkey");
TEST(model, ());
auto const & cl = classif();
feature::TypesHolder holder;
holder.Add(cl.GetTypeByPath({"highway", "footway", "tunnel"}));
TEST(model->HasRoadType(holder), ());
TEST_EQUAL(model->GetSpeed(holder, DefaultSpeedParams()), BicycleModel::DismountSpeed(), ());
}
} // namespace bicycle_model_test