Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More real-world hov lane change/transition test case #3330

Merged
merged 5 commits into from Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -41,6 +41,7 @@
* ADDED: pull ubuntu:20.04 base image before building [#3233](https://github.com/valhalla/valhalla/pull/3223)
* CHANGED: Improve Loki nearest-neighbour performance for large radius searches in open space [#3233](https://github.com/valhalla/valhalla/pull/3324)
* ADDED: testing infrastructure for scripts and valhalla_build_config tests [#3308](https://github.com/valhalla/valhalla/pull/3308)
* CHANGED: Improved existing hov lane transition test case to make more realistic [#3330](https://github.com/valhalla/valhalla/pull/3330)

## Release Date: 2021-07-20 Valhalla 3.1.3
* **Removed**
Expand Down
46 changes: 31 additions & 15 deletions test/gurka/test_hov.cc
Expand Up @@ -454,22 +454,36 @@ class HOVChoices : public ::testing::Test {
static std::shared_ptr<baldr::GraphReader> reader;

static void SetUpTestSuite() {
constexpr double gridsize = 10;

// This gridsize/map is attempting to emulate a real-world hov-lane that parallels
// a highway. It isn't perfect... the hov-lane would probably be a little less than
// 5 meters from the highway lane... and AC would be much longer. The transition from
// E to A and from C to F are about 90 m, which is accurate based on my measurements.
// Note also that EA is a motorway-link, which emulates what I'm seeing in the real
// world. However, CF is not a motorway-link.
constexpr double gridsize = 5;
const std::string ascii_map = R"(
A-----------------------------------------------C
D----------E-------------------------------------------------F----------------G
A------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------C
D--------------E--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------F----------------G
)";
const gurka::ways ways =
{{"DEFG",
{{"highway", "motorway"}, {"oneway", "yes"}, {"maxspeed", "35"}, {"name", "RT 36"}}},
{"EACF",
{{"highway", "motorway"}, {"oneway", "yes"}, {"maxspeed", "40"}, {"name", "RT 36"}}},
{"EA",
{{"highway", "motorway_link"},
{"oneway", "yes"},
{"name", "US 36 Express Lane"},
{"hov", "designated"},
{"hov:minimum", "3"},
{"maxspeed", "65"},
{"toll", "yes"}}},
{"ACF",
{{"highway", "motorway"},
{"oneway", "yes"},
{"name", "HOTExpress3"},
{"name", "US 36 Express Lane"},
{"hov", "designated"},
{"hov:minimum", "3"},
{"maxspeed", "95"},
{"maxspeed", "65"},
{"toll", "yes"}}}};

const gurka::nodes nodes;
Expand Down Expand Up @@ -520,12 +534,13 @@ TEST_F(HOVChoices, choices) {
.str();
auto result = gurka::do_action(Options::route, map, req, reader);

// User allows hot-lanes and the router can choose the super fast HOTExpress3.
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver_size(), 4);
// User allows hot-lanes and the router can choose the faster US 36 Express Lane.
// Note: the return angle from the HOV lane onto the highway is very slight,
// so we don't announce a maneuver returning onto RT-36.
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver_size(), 3);
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver(0).street_name(0).value(), "RT 36");
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver(1).street_name(0).value(),
"HOTExpress3");
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver(2).street_name(0).value(), "RT 36");
"US 36 Express Lane");
}

{
Expand All @@ -536,11 +551,12 @@ TEST_F(HOVChoices, choices) {
.str();
auto result = gurka::do_action(Options::route, map, req, reader);

// User allows hov3-lanes and the router can choose the super fast HOTExpress3.
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver_size(), 4);
// User allows hov3-lanes and the router can choose the faster US 36 Express Lane.
// Note: the return angle from the HOV lane onto the highway is very slight,
// so we don't announce a maneuver returning onto RT-36.
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver_size(), 3);
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver(0).street_name(0).value(), "RT 36");
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver(1).street_name(0).value(),
"HOTExpress3");
EXPECT_EQ(result.directions().routes(0).legs(0).maneuver(2).street_name(0).value(), "RT 36");
"US 36 Express Lane");
}
}