bike: normal speed on paths with asphalt, add tests

This commit is contained in:
Emil Tin 2013-09-12 14:15:50 +02:00
parent d9e3c43c91
commit 47f11fc3a6
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,40 @@
@routing @surface @bicycle
Feature: Bike - Surfaces
Background:
Given the profile "bicycle"
Scenario: Bicycle - Slow surfaces
Then routability should be
| highway | surface | bothw |
| cycleway | | 49s |
| cycleway | asphalt | 49s |
| cycleway | cobblestone:flattened | 73s |
| cycleway | paving_stones | 73s |
| cycleway | compacted | 73s |
| cycleway | cobblestone | 121s |
| cycleway | unpaved | 121s |
| cycleway | fine_gravel | 121s |
| cycleway | gravel | 121s |
| cycleway | pebbelstone | 121s |
| cycleway | dirt | 121s |
| cycleway | earth | 121s |
| cycleway | grass | 121s |
| cycleway | mud | 241s |
| cycleway | sand | 241s |
Scenario: Bicycle - Good surfaces on small paths
Then routability should be
| highway | surface | bothw |
| cycleway | | 49s |
| path | | 61s |
| track | | 61s |
| track | asphalt | 49s |
| path | asphalt | 49s |
Scenario: Bicycle - Surfaces should not make unknown ways routable
Then routability should be
| highway | surface | bothw |
| cycleway | | 49s |
| nosense | | |
| nosense | asphalt | |

View File

@ -66,6 +66,7 @@ route_speeds = {
}
surface_speeds = {
["asphalt"] = default_speed,
["cobblestone:flattened"] = 10,
["paving_stones"] = 10,
["compacted"] = 10,
@ -317,8 +318,12 @@ function way_function (way)
if surface then
surface_speed = surface_speeds[surface]
if surface_speed then
way.speed = math.min(way.speed, surface_speed)
way.backward_speed = math.min(way.backward_speed, surface_speed)
if way.speed > 0 then
way.speed = surface_speed
end
if way.backward_speed > 0 then
way.backward_speed = surface_speed
end
end
end