[routing] Support conditional routing

Signed-off-by: Henry Sternberg <henry@bluelightmaps.com>
This commit is contained in:
Henry Sternberg
2025-08-23 16:34:45 +01:00
committed by x7z4w
parent b761a60246
commit 718d0f726b
2 changed files with 249 additions and 258 deletions

View File

@@ -64,13 +64,7 @@ public:
case Header::WithoutAccessConditional: DeserializeAccess(src, vehicleType, roadAccess); break; case Header::WithoutAccessConditional: DeserializeAccess(src, vehicleType, roadAccess); break;
case Header::WithAccessConditional: case Header::WithAccessConditional:
DeserializeAccess(src, vehicleType, roadAccess); DeserializeAccess(src, vehicleType, roadAccess);
DeserializeAccessConditional(src, vehicleType, roadAccess);
/// @todo By VNG: WTF?
// access:conditional should be switch off for release 10.0 and probably for the next one.
// It means that they should be switch off for cross_mwm section generation and for runtime.
// To switch on access:conditional the line below should be uncommented.
// Also tests in routing/routing_tests/road_access_test.cpp should be uncommented.
// DeserializeAccessConditional(src, vehicleType, roadAccess);
break; break;
} }
} }

View File

@@ -53,77 +53,77 @@ void FillRoadAccessBySample_2(RoadAccess & roadAccess)
roadAccess.SetAccess(std::move(wayToAccess), std::move(pointToAccess)); roadAccess.SetAccess(std::move(wayToAccess), std::move(pointToAccess));
} }
// void FillRoadAccessBySampleConditional_1(RoadAccess & roadAccess) void FillRoadAccessBySampleConditional_1(RoadAccess & roadAccess)
//{ {
// std::vector<std::string> const openingHoursStrings = { std::vector<std::string> const openingHoursStrings = {
// "Mo-Su", "10:00-18:00", "Mo-Fr 10:00-14:00", "09:00-13:00", "Apr - May", "2010 - 2100"}; "Mo-Su", "10:00-18:00", "Mo-Fr 10:00-14:00", "09:00-13:00", "Apr - May", "2010 - 2100"};
//
// std::vector<osmoh::OpeningHours> openingHours; std::vector<osmoh::OpeningHours> openingHours;
// for (auto const & oh : openingHoursStrings) for (auto const & oh : openingHoursStrings)
// { {
// openingHours.emplace_back(oh); openingHours.emplace_back(oh);
// TEST(openingHours.back().IsValid(), ()); TEST(openingHours.back().IsValid(), ());
// } }
//
// RoadAccess::Conditional conditional_1; RoadAccess::Conditional conditional_1;
// conditional_1.Insert(RoadAccess::Type::No, std::move(openingHours[0])); conditional_1.Insert(RoadAccess::Type::No, std::move(openingHours[0]));
// conditional_1.Insert(RoadAccess::Type::Private, std::move(openingHours[1])); conditional_1.Insert(RoadAccess::Type::Private, std::move(openingHours[1]));
//
// RoadAccess::Conditional conditional_2; RoadAccess::Conditional conditional_2;
// conditional_2.Insert(RoadAccess::Type::Destination, std::move(openingHours[2])); conditional_2.Insert(RoadAccess::Type::Destination, std::move(openingHours[2]));
//
// RoadAccess::Conditional conditional_3; RoadAccess::Conditional conditional_3;
// conditional_3.Insert(RoadAccess::Type::No, std::move(openingHours[4])); conditional_3.Insert(RoadAccess::Type::No, std::move(openingHours[4]));
// conditional_3.Insert(RoadAccess::Type::Destination, std::move(openingHours[3])); conditional_3.Insert(RoadAccess::Type::Destination, std::move(openingHours[3]));
//
// RoadAccess::Conditional conditional_4; RoadAccess::Conditional conditional_4;
// conditional_4.Insert(RoadAccess::Type::Destination, std::move(openingHours[5])); conditional_4.Insert(RoadAccess::Type::Destination, std::move(openingHours[5]));
//
// RoadAccess::WayToAccessConditional wayToAccessConditional = {{1 /* featureId */, conditional_1}, RoadAccess::WayToAccessConditional wayToAccessConditional = {{1 /* featureId */, conditional_1},
// {2 /* featureId */, conditional_2}}; {2 /* featureId */, conditional_2}};
//
// RoadAccess::PointToAccessConditional pointToAccessConditional = { RoadAccess::PointToAccessConditional pointToAccessConditional = {
// {RoadPoint(3 /* featureId */, 0 /* pointId */), conditional_3}, {RoadPoint(3 /* featureId */, 0 /* pointId */), conditional_3},
// {RoadPoint(4 /* featureId */, 7 /* pointId */), conditional_4}}; {RoadPoint(4 /* featureId */, 7 /* pointId */), conditional_4}};
//
// roadAccess.SetAccessConditional(std::move(wayToAccessConditional), std::move(pointToAccessConditional)); roadAccess.SetAccessConditional(std::move(wayToAccessConditional), std::move(pointToAccessConditional));
// } }
//
// void FillRoadAccessBySampleConditional_2(RoadAccess & roadAccess) void FillRoadAccessBySampleConditional_2(RoadAccess & roadAccess)
//{ {
// std::vector<std::string> const openingHoursStrings = { std::vector<std::string> const openingHoursStrings = {
// "Mo", "Apr-May 03:00-04:25", "Mo-Sa 12:00-13:00", "2010-2098", "Nov-Apr", "19:00-21:00"}; "Mo", "Apr-May 03:00-04:25", "Mo-Sa 12:00-13:00", "2010-2098", "Nov-Apr", "19:00-21:00"};
//
// std::vector<osmoh::OpeningHours> openingHours; std::vector<osmoh::OpeningHours> openingHours;
// for (auto const & oh : openingHoursStrings) for (auto const & oh : openingHoursStrings)
// { {
// openingHours.emplace_back(oh); openingHours.emplace_back(oh);
// TEST(openingHours.back().IsValid(), (oh)); TEST(openingHours.back().IsValid(), (oh));
// } }
//
// RoadAccess::Conditional conditional_1; RoadAccess::Conditional conditional_1;
// conditional_1.Insert(RoadAccess::Type::Private, std::move(openingHours[0])); conditional_1.Insert(RoadAccess::Type::Private, std::move(openingHours[0]));
//
// RoadAccess::Conditional conditional_2; RoadAccess::Conditional conditional_2;
// conditional_2.Insert(RoadAccess::Type::No, std::move(openingHours[1])); conditional_2.Insert(RoadAccess::Type::No, std::move(openingHours[1]));
// conditional_2.Insert(RoadAccess::Type::Private, std::move(openingHours[2])); conditional_2.Insert(RoadAccess::Type::Private, std::move(openingHours[2]));
//
// RoadAccess::Conditional conditional_3; RoadAccess::Conditional conditional_3;
// conditional_3.Insert(RoadAccess::Type::Destination, std::move(openingHours[3])); conditional_3.Insert(RoadAccess::Type::Destination, std::move(openingHours[3]));
//
// RoadAccess::Conditional conditional_4; RoadAccess::Conditional conditional_4;
// conditional_4.Insert(RoadAccess::Type::No, std::move(openingHours[4])); conditional_4.Insert(RoadAccess::Type::No, std::move(openingHours[4]));
// conditional_4.Insert(RoadAccess::Type::No, std::move(openingHours[5])); conditional_4.Insert(RoadAccess::Type::No, std::move(openingHours[5]));
//
// RoadAccess::WayToAccessConditional wayToAccessConditional = {{1 /* featureId */, conditional_1}, RoadAccess::WayToAccessConditional wayToAccessConditional = {{1 /* featureId */, conditional_1},
// {2 /* featureId */, conditional_2}}; {2 /* featureId */, conditional_2}};
//
// RoadAccess::PointToAccessConditional pointToAccessConditional = { RoadAccess::PointToAccessConditional pointToAccessConditional = {
// {RoadPoint(3 /* featureId */, 10 /* pointId */), conditional_3}, {RoadPoint(3 /* featureId */, 10 /* pointId */), conditional_3},
// {RoadPoint(4 /* featureId */, 2 /* pointId */), conditional_4}}; {RoadPoint(4 /* featureId */, 2 /* pointId */), conditional_4}};
//
// roadAccess.SetAccessConditional(std::move(wayToAccessConditional), std::move(pointToAccessConditional)); roadAccess.SetAccessConditional(std::move(wayToAccessConditional), std::move(pointToAccessConditional));
// } }
class RoadAccessSerDesTest class RoadAccessSerDesTest
{ {
@@ -167,61 +167,58 @@ UNIT_CLASS_TEST(RoadAccessSerDesTest, RoadAccess_Serdes)
TestDeserialize(VehicleType::Pedestrian, roadAccessPedestrian); TestDeserialize(VehicleType::Pedestrian, roadAccessPedestrian);
} }
// @TODO Tests below and functions FillRoadAccessBySampleConditional_1 and UNIT_CLASS_TEST(RoadAccessSerDesTest, RoadAccess_Serdes_Conditional_One_Vehicle)
// FillRoadAccessBySampleConditional_2 should be uncommented when access:conditional is {
// switched on. auto constexpr kVehicleTypeCount = static_cast<size_t>(VehicleType::Count);
// UNIT_CLASS_TEST(RoadAccessSerDesTest, RoadAccess_Serdes_Conditional_One_Vehicle) for (size_t vehicleTypeId = 0; vehicleTypeId < kVehicleTypeCount; ++vehicleTypeId)
//{ {
// auto constexpr kVehicleTypeCount = static_cast<size_t>(VehicleType::Count); RoadAccess roadAccess;
// for (size_t vehicleTypeId = 0; vehicleTypeId < kVehicleTypeCount; ++vehicleTypeId) FillRoadAccessBySampleConditional_1(roadAccess);
// {
// RoadAccess roadAccess; RoadAccessSerializer::RoadAccessByVehicleType roadAccessAllTypes;
// FillRoadAccessBySampleConditional_1(roadAccess); roadAccessAllTypes[vehicleTypeId] = roadAccess;
//
// RoadAccessSerializer::RoadAccessByVehicleType roadAccessAllTypes; Serialize(roadAccessAllTypes);
// roadAccessAllTypes[vehicleTypeId] = roadAccess; TestDeserialize(static_cast<VehicleType>(vehicleTypeId), roadAccess);
// ClearBuffer();
// Serialize(roadAccessAllTypes); }
// TestDeserialize(static_cast<VehicleType>(vehicleTypeId), roadAccess); }
// ClearBuffer();
// } UNIT_CLASS_TEST(RoadAccessSerDesTest, RoadAccess_Serdes_Conditional_Several_Vehicles)
//} {
// RoadAccess roadAccessCar;
// UNIT_CLASS_TEST(RoadAccessSerDesTest, RoadAccess_Serdes_Conditional_Several_Vehicles) FillRoadAccessBySampleConditional_1(roadAccessCar);
//{
// RoadAccess roadAccessCar; RoadAccess roadAccessPedestrian;
// FillRoadAccessBySampleConditional_1(roadAccessCar); FillRoadAccessBySampleConditional_2(roadAccessPedestrian);
//
// RoadAccess roadAccessPedestrian; RoadAccessSerializer::RoadAccessByVehicleType roadAccessAllTypes;
// FillRoadAccessBySampleConditional_2(roadAccessPedestrian); roadAccessAllTypes[static_cast<size_t>(VehicleType::Car)] = roadAccessCar;
// roadAccessAllTypes[static_cast<size_t>(VehicleType::Pedestrian)] = roadAccessPedestrian;
// RoadAccessSerializer::RoadAccessByVehicleType roadAccessAllTypes;
// roadAccessAllTypes[static_cast<size_t>(VehicleType::Car)] = roadAccessCar; Serialize(roadAccessAllTypes);
// roadAccessAllTypes[static_cast<size_t>(VehicleType::Pedestrian)] = roadAccessPedestrian; TestDeserialize(VehicleType::Car, roadAccessCar);
// TestDeserialize(VehicleType::Pedestrian, roadAccessPedestrian);
// Serialize(roadAccessAllTypes); }
// TestDeserialize(VehicleType::Car, roadAccessCar);
// TestDeserialize(VehicleType::Pedestrian, roadAccessPedestrian); UNIT_CLASS_TEST(RoadAccessSerDesTest, RoadAccess_Serdes_Conditional_Mixed_Several_Vehicles)
//} {
// RoadAccess roadAccessCar;
// UNIT_CLASS_TEST(RoadAccessSerDesTest, RoadAccess_Serdes_Conditional_Mixed_Several_Vehicles) FillRoadAccessBySampleConditional_1(roadAccessCar);
//{ FillRoadAccessBySample_1(roadAccessCar);
// RoadAccess roadAccessCar;
// FillRoadAccessBySampleConditional_1(roadAccessCar); RoadAccess roadAccessPedestrian;
// FillRoadAccessBySample_1(roadAccessCar); FillRoadAccessBySampleConditional_2(roadAccessPedestrian);
// FillRoadAccessBySample_2(roadAccessPedestrian);
// RoadAccess roadAccessPedestrian;
// FillRoadAccessBySampleConditional_2(roadAccessPedestrian); RoadAccessSerializer::RoadAccessByVehicleType roadAccessAllTypes;
// FillRoadAccessBySample_2(roadAccessPedestrian); roadAccessAllTypes[static_cast<size_t>(VehicleType::Car)] = roadAccessCar;
// roadAccessAllTypes[static_cast<size_t>(VehicleType::Pedestrian)] = roadAccessPedestrian;
// RoadAccessSerializer::RoadAccessByVehicleType roadAccessAllTypes;
// roadAccessAllTypes[static_cast<size_t>(VehicleType::Car)] = roadAccessCar; Serialize(roadAccessAllTypes);
// roadAccessAllTypes[static_cast<size_t>(VehicleType::Pedestrian)] = roadAccessPedestrian; TestDeserialize(VehicleType::Car, roadAccessCar);
// TestDeserialize(VehicleType::Pedestrian, roadAccessPedestrian);
// Serialize(roadAccessAllTypes); }
// TestDeserialize(VehicleType::Car, roadAccessCar);
// TestDeserialize(VehicleType::Pedestrian, roadAccessPedestrian);
//}
UNIT_TEST(RoadAccess_WayBlocked) UNIT_TEST(RoadAccess_WayBlocked)
{ {
@@ -369,42 +366,42 @@ UNIT_TEST(RoadAccess_WayBlockedConditional)
TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, expectedEdges); TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, expectedEdges);
} }
// UNIT_TEST(RoadAccess_PointBlockedConditional) UNIT_TEST(RoadAccess_PointBlockedConditional)
//{ {
// uint32_t const numVertices = 4; uint32_t const numVertices = 4;
// TestIndexGraphTopology graph(numVertices); TestIndexGraphTopology graph(numVertices);
//
// graph.AddDirectedEdge(0, 1, 1.0); graph.AddDirectedEdge(0, 1, 1.0);
// graph.AddDirectedEdge(1, 2, 1.0); graph.AddDirectedEdge(1, 2, 1.0);
// graph.AddDirectedEdge(2, 3, 1.0); graph.AddDirectedEdge(2, 3, 1.0);
//
// double expectedWeight = 3.0; double expectedWeight = 3.0;
// vector<TestEdge> expectedEdges = {{0, 1}, {1, 2}, {2, 3}}; vector<TestEdge> expectedEdges = {{0, 1}, {1, 2}, {2, 3}};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
//
// graph.SetVertexAccessConditional(1, RoadAccess::Type::No, "Jan - Jul"); graph.SetVertexAccessConditional(1, RoadAccess::Type::No, "Jan - Jul");
//
// auto const april = []() { auto const april = []() {
// return GetUnixtimeByDate(2020, Month::Apr, 1, 12 /* hh */, 00 /* mm */); return GetUnixtimeByDate(2020, Month::Apr, 1, 12 /* hh */, 00 /* mm */);
// }; };
//
// graph.SetCurrentTimeGetter(april); graph.SetCurrentTimeGetter(april);
// expectedWeight = 0; expectedWeight = 0;
// expectedEdges = {}; expectedEdges = {};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
//
// auto const november = []() { auto const november = []() {
// return GetUnixtimeByDate(2020, Month::Nov, 1, 12 /* hh */, 00 /* mm */); return GetUnixtimeByDate(2020, Month::Nov, 1, 12 /* hh */, 00 /* mm */);
// }; };
//
// graph.SetCurrentTimeGetter(november); graph.SetCurrentTimeGetter(november);
// expectedWeight = 3.0; expectedWeight = 3.0;
// expectedEdges = {{0, 1}, {1, 2}, {2, 3}}; expectedEdges = {{0, 1}, {1, 2}, {2, 3}};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
// } }
UNIT_TEST(RoadAccess_WayBlockedAvoidConditional) UNIT_TEST(RoadAccess_WayBlockedAvoidConditional)
{ {
@@ -451,56 +448,56 @@ UNIT_TEST(RoadAccess_WayBlockedAvoidConditional)
TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight, expectedEdges); TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight, expectedEdges);
} }
// UNIT_TEST(RoadAccess_PointBlockedAvoidConditional) UNIT_TEST(RoadAccess_PointBlockedAvoidConditional)
//{ {
// uint32_t const numVertices = 4; uint32_t const numVertices = 4;
// TestIndexGraphTopology graph(numVertices); TestIndexGraphTopology graph(numVertices);
//
// graph.AddDirectedEdge(0, 1, 1.0); graph.AddDirectedEdge(0, 1, 1.0);
// graph.AddDirectedEdge(0, 2, 10.0); graph.AddDirectedEdge(0, 2, 10.0);
// graph.AddDirectedEdge(1, 3, 1.0); graph.AddDirectedEdge(1, 3, 1.0);
// graph.AddDirectedEdge(2, 3, 10.0); graph.AddDirectedEdge(2, 3, 10.0);
//
// double expectedWeight = 2.0; double expectedWeight = 2.0;
// vector<TestEdge> expectedEdges = {{0, 1}, {1, 3}}; vector<TestEdge> expectedEdges = {{0, 1}, {1, 3}};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
//
// graph.SetVertexAccessConditional(1, RoadAccess::Type::No, "Mo-Fr 10:00 - 19:00"); graph.SetVertexAccessConditional(1, RoadAccess::Type::No, "Mo-Fr 10:00 - 19:00");
//
// auto const mondayAlmostTenHours = []() { auto const mondayAlmostTenHours = []() {
// return GetUnixtimeByDate(2020, Month::Apr, Weekday::Monday, 9 /* hh */, 50 /* mm */); return GetUnixtimeByDate(2020, Month::Apr, Weekday::Monday, 9 /* hh */, 50 /* mm */);
// }; };
//
// // In this time we probably will able to pass vertex: 1, but we are not sure, so we should avoid // In this time we probably will able to pass vertex: 1, but we are not sure, so we should avoid
// // such edges. // such edges.
// graph.SetCurrentTimeGetter(mondayAlmostTenHours); graph.SetCurrentTimeGetter(mondayAlmostTenHours);
// expectedWeight = 20.0; expectedWeight = 20.0;
// expectedEdges = {{0, 2}, {2, 3}}; expectedEdges = {{0, 2}, {2, 3}};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
//
// graph.SetEdgeAccess(0, 2, RoadAccess::Type::No); graph.SetEdgeAccess(0, 2, RoadAccess::Type::No);
//
// // But if this is the only path (we blocked 0->2 above), we should pass through vertex: 1 anyway. // But if this is the only path (we blocked 0->2 above), we should pass through vertex: 1 anyway.
// graph.SetCurrentTimeGetter(mondayAlmostTenHours); graph.SetCurrentTimeGetter(mondayAlmostTenHours);
// expectedWeight = 2.0; expectedWeight = 2.0;
// expectedEdges = {{0, 1}, {1, 3}}; expectedEdges = {{0, 1}, {1, 3}};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
//
// auto const mondayTwelveHours = []() { auto const mondayTwelveHours = []() {
// return GetUnixtimeByDate(2020, Month::Apr, Weekday::Monday, 12 /* hh */, 00 /* mm */); return GetUnixtimeByDate(2020, Month::Apr, Weekday::Monday, 12 /* hh */, 00 /* mm */);
// }; };
//
// // But if we sure that in this time vertex: 1 will be blocked, we definitely should not pass // But if we sure that in this time vertex: 1 will be blocked, we definitely should not pass
// // through vertex: 1. In this case no way will be found. // through vertex: 1. In this case no way will be found.
// graph.SetCurrentTimeGetter(mondayTwelveHours); graph.SetCurrentTimeGetter(mondayTwelveHours);
// expectedWeight = 0.0; expectedWeight = 0.0;
// expectedEdges = {}; expectedEdges = {};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
// } }
UNIT_TEST(RoadAccess_WayBlockedConditional_Yes_No) UNIT_TEST(RoadAccess_WayBlockedConditional_Yes_No)
{ {
@@ -536,45 +533,45 @@ UNIT_TEST(RoadAccess_WayBlockedConditional_Yes_No)
TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, expectedEdges); TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, expectedEdges);
} }
// UNIT_TEST(RoadAccess_PointBlockedConditional_Yes_No) UNIT_TEST(RoadAccess_PointBlockedConditional_Yes_No)
//{ {
// uint32_t const numVertices = 4; uint32_t const numVertices = 4;
// TestIndexGraphTopology graph(numVertices); TestIndexGraphTopology graph(numVertices);
//
// graph.AddDirectedEdge(0, 1, 1.0); graph.AddDirectedEdge(0, 1, 1.0);
// graph.AddDirectedEdge(1, 2, 1.0); graph.AddDirectedEdge(1, 2, 1.0);
// graph.AddDirectedEdge(2, 3, 1.0); graph.AddDirectedEdge(2, 3, 1.0);
//
// double expectedWeight = 3.0; double expectedWeight = 3.0;
// vector<TestEdge> expectedEdges = {{0, 1}, {1, 2}, {2, 3}}; vector<TestEdge> expectedEdges = {{0, 1}, {1, 2}, {2, 3}};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
//
// graph.SetVertexAccessConditional(1, RoadAccess::Type::No, "Mo-Fr"); graph.SetVertexAccessConditional(1, RoadAccess::Type::No, "Mo-Fr");
// graph.SetVertexAccessConditional(1, RoadAccess::Type::Yes, "Sa-Su"); graph.SetVertexAccessConditional(1, RoadAccess::Type::Yes, "Sa-Su");
//
// auto const tuesday = []() { auto const tuesday = []() {
// return GetUnixtimeByDate(2020, Month::Apr, Weekday::Tuesday, 10 /* hh */, 00 /* mm */); return GetUnixtimeByDate(2020, Month::Apr, Weekday::Tuesday, 10 /* hh */, 00 /* mm */);
// }; };
//
// // Way is blocked from Monday to Friday // Way is blocked from Monday to Friday
// graph.SetCurrentTimeGetter(tuesday); graph.SetCurrentTimeGetter(tuesday);
// expectedWeight = 0; expectedWeight = 0;
// expectedEdges = {}; expectedEdges = {};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, false /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
//
// auto const saturday = []() { auto const saturday = []() {
// return GetUnixtimeByDate(2020, Month::Nov, Weekday::Saturday, 10 /* hh */, 00 /* mm */); return GetUnixtimeByDate(2020, Month::Nov, Weekday::Saturday, 10 /* hh */, 00 /* mm */);
// }; };
//
// // And open from Saturday to Sunday // And open from Saturday to Sunday
// graph.SetCurrentTimeGetter(saturday); graph.SetCurrentTimeGetter(saturday);
// expectedWeight = 3.0; expectedWeight = 3.0;
// expectedEdges = {{0, 1}, {1, 2}, {2, 3}}; expectedEdges = {{0, 1}, {1, 2}, {2, 3}};
// TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight, TestTopologyGraph(graph, 0 /* from */, 3 /* to */, true /* pathFound */, expectedWeight,
// expectedEdges); expectedEdges);
// } }
UNIT_TEST(RoadAccess_WayBlockedAvoidPrivateConditional) UNIT_TEST(RoadAccess_WayBlockedAvoidPrivateConditional)
{ {