From 97f1dc074928dea6d7fd6d478db7cdf1fb61eb7e Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Mon, 4 Feb 2013 11:15:06 +0100 Subject: [PATCH] update maxspeed tests, remove maxspeed from foot profile --- features/bicycle/maxspeed.feature | 55 +++++++++++++++++-------------- features/car/maxspeed.feature | 52 +++++++++++++++-------------- features/foot/maxspeed.feature | 20 +++++++++++ features/support/shortcuts.rb | 3 ++ profiles/foot.lua | 5 +-- 5 files changed, 82 insertions(+), 53 deletions(-) create mode 100644 features/foot/maxspeed.feature create mode 100644 features/support/shortcuts.rb diff --git a/features/bicycle/maxspeed.feature b/features/bicycle/maxspeed.feature index 30d82b7e8..9df5029de 100644 --- a/features/bicycle/maxspeed.feature +++ b/features/bicycle/maxspeed.feature @@ -3,31 +3,36 @@ Feature: Bike - Max speed restrictions Background: Use specific speeds Given the profile "bicycle" - - Scenario: Bike - Respect maxspeeds when lower that way type speed - Given the node map - | a | b | c | - And the ways - | nodes | highway | maxspeed | - | ab | residential | | - | bc | residential | 10 | + Scenario: Bicycle - Respect maxspeeds when lower that way type speed + Then routability should be + | highway | maxspeed | bothw | + | residential | | 40s ~10% | + | residential | 10 | 72s ~10% | - When I route I should get - | from | to | route | time | - | a | b | ab | 20s ~5% | - | b | c | bc | 36s ~5% | + Scenario: Bicycle - Ignore maxspeed when higher than way speed + Then routability should be + | highway | maxspeed | bothw | + | residential | | 40s ~10% | + | residential | 80 | 40s ~10% | + + @todo + Scenario: Bicycle - Maxspeed formats + Then routability should be + | highway | maxspeed | bothw | + | residential | | 40s ~10% | + | residential | 5 | 144s ~10% | + | residential | 5mph | 90s ~10% | + | residential | 5 mph | 90s ~10% | + | residential | 5MPH | 90s ~10% | + | residential | 5 MPH | 90s ~10% | + | trunk | 5unknown | 40s ~10% | + | trunk | 5 unknown | 40s ~10% | - Scenario: Bike - Do not use maxspeed when higher that way type speed - Given the node map - | a | b | c | - - And the ways - | nodes | highway | maxspeed | - | ab | residential | | - | bc | residential | 80 | - - When I route I should get - | from | to | route | time | - | a | b | ab | 20s ~5% | - | b | c | bc | 20s ~5% | + @todo + Scenario: Bicycle - Maxspeed special tags + Then routability should be + | highway | maxspeed | bothw | + | residential | | 40s ~10% | + | residential | none | 40s ~10% | + | residential | signals | 40s ~10% | diff --git a/features/car/maxspeed.feature b/features/car/maxspeed.feature index cc31c6c13..1ca86aaea 100644 --- a/features/car/maxspeed.feature +++ b/features/car/maxspeed.feature @@ -3,32 +3,36 @@ Feature: Car - Max speed restrictions Background: Use specific speeds Given the profile "car" - Given a grid size of 1000 meters - + Scenario: Car - Respect maxspeeds when lower that way type speed - Given the node map - | a | b | c | - - And the ways - | nodes | highway | maxspeed | - | ab | trunk | | - | bc | trunk | 10 | - - When I route I should get - | from | to | route | time | - | a | b | ab | 42s ~10% | - | b | c | bc | 360s ~10% | + Then routability should be + | highway | maxspeed | bothw | + | trunk | | 9s ~10% | + | trunk | 10 | 72s ~10% | Scenario: Car - Ignore maxspeed when higher than way speed - Given the node map - | a | b | c | + Then routability should be + | highway | maxspeed | bothw | + | residential | | 29s ~10% | + | residential | 85 | 29s ~10% | - And the ways - | nodes | highway | maxspeed | - | ab | residential | | - | bc | residential | 85 | + @todo + Scenario: Car - Maxspeed formats + Then routability should be + | highway | maxspeed | bothw | + | trunk | | 9s ~10% | + | trunk | 10 | 73s ~10% | + | trunk | 10mph | 45s ~10% | + | trunk | 10 mph | 45s ~10% | + | trunk | 10MPH | 45s ~10% | + | trunk | 10 MPH | 45s ~10% | + | trunk | 10unknown | 9s ~10% | + | trunk | 10 unknown | 9s ~10% | - When I route I should get - | from | to | route | time | - | a | b | ab | 144s ~10% | - | b | c | bc | 144s ~10% | + @todo + Scenario: Car - Maxspeed special tags + Then routability should be + | highway | maxspeed | bothw | + | trunk | | 9s ~10% | + | trunk | none | 9s ~10% | + | trunk | signals | 9s ~10% | diff --git a/features/foot/maxspeed.feature b/features/foot/maxspeed.feature new file mode 100644 index 000000000..8a3571a04 --- /dev/null +++ b/features/foot/maxspeed.feature @@ -0,0 +1,20 @@ +@routing @maxspeed @foot +Feature: Foot - Ignore max speed restrictions + +Background: Use specific speeds + Given the profile "foot" + +@todo +Scenario: Foot - Ignore maxspeed + Then routability should be + | highway | maxspeed | bothw | + | residential | | 145s ~10% | + | residential | 1 | 145s ~10% | + | residential | 100 | 145s ~10% | + | residential | 1 | 145s ~10% | + | residential | 1mph | 145s ~10% | + | residential | 1 mph | 145s ~10% | + | residential | 1unknown | 145s ~10% | + | residential | 1 unknown | 145s ~10% | + | residential | none | 145s ~10% | + | residential | signals | 145s ~10% | diff --git a/features/support/shortcuts.rb b/features/support/shortcuts.rb new file mode 100644 index 000000000..20bc3c0fe --- /dev/null +++ b/features/support/shortcuts.rb @@ -0,0 +1,3 @@ +def shortcuts_hash + @shortcuts_hash ||= {} +end diff --git a/profiles/foot.lua b/profiles/foot.lua index 3f689a2d1..e85cc2fd0 100644 --- a/profiles/foot.lua +++ b/profiles/foot.lua @@ -152,10 +152,7 @@ function way_function (way, numberOfNodesInWay) -- Set the avg speed on the way if it is accessible by road class if (speed_profile[highway] ~= nil and way.speed == -1 ) then - if (0 < maxspeed and not take_minimum_of_speeds) or (maxspeed == 0) then - maxspeed = math.huge - end - way.speed = math.min(speed_profile[highway], maxspeed) + way.speed = speed_profile[highway] end -- Set the avg speed on ways that are marked accessible