test ferry duration on part of route

This commit is contained in:
Emil Tin 2012-11-04 14:00:21 +01:00
parent 263dcbd188
commit 7493d8aa49
3 changed files with 90 additions and 1 deletions

View File

@ -113,3 +113,23 @@ Feature: Bike - Handle ferry routes
| from | to | route | time | | from | to | route | time |
| a | g | abcdefg | 23400s +-1 | | a | g | abcdefg | 23400s +-1 |
| g | a | abcdefg | 23400s +-1 | | g | a | abcdefg | 23400s +-1 |
Scenario: Bike - Ferry duration, individual parts
Given the node map
| x | y | | z | | | v |
| a | b | | c | | | d |
And the ways
| nodes | highway | route | bicycle | duration |
| xa | primary | | | |
| yb | primary | | | |
| zc | primary | | | |
| vd | primary | | | |
| abcd | | ferry | yes | 1:00 |
When I route I should get
| from | to | route | time |
| a | d | abcd | 3600s +-1 |
| a | b | abcd | 600s +-1 |
| b | c | abcd | 1200s +-1 |
| c | d | abcd | 1800s +-1 |

View File

@ -0,0 +1,60 @@
@routing @testbot @ferry
Feature: Testbot - Handle ferry routes
Background:
Given the speedprofile "testbot"
Scenario: Testbot - Ferry duration, single node
Given the node map
| a | b | c | d |
| | | e | f |
| | | g | h |
| | | i | j |
And the ways
| nodes | highway | route | bicycle | duration |
| ab | primary | | | |
| cd | primary | | | |
| ef | primary | | | |
| gh | primary | | | |
| ij | primary | | | |
| bc | | ferry | yes | 0:01 |
| be | | ferry | yes | 0:10 |
| bg | | ferry | yes | 1:00 |
| bi | | ferry | yes | 10:00 |
Scenario: Testbot - Ferry duration, multiple nodes
Given the node map
| x | | | | | y |
| | a | b | c | d | |
And the ways
| nodes | highway | route | bicycle | duration |
| xa | primary | | | |
| yd | primary | | | |
| abcd | | ferry | yes | 1:00 |
When I route I should get
| from | to | route | time |
| a | d | abcd | 3600s +-1 |
| d | a | abcd | 3600s +-1 |
Scenario: Bike - Ferry duration, individual parts
Given the node map
| x | y | | z | | | v |
| a | b | | c | | | d |
And the ways
| nodes | highway | route | bicycle | duration |
| xa | primary | | | |
| yb | primary | | | |
| zc | primary | | | |
| vd | primary | | | |
| abcd | | ferry | yes | 1:00 |
When I route I should get
| from | to | route | time |
| a | d | abcd | 3600s +-1 |
| a | b | abcd | 600s +-1 |
| b | c | abcd | 1200s +-1 |
| c | d | abcd | 1800s +-1 |

View File

@ -43,9 +43,18 @@ function way_function (way, numberOfNodesInWay)
local highway = way.tags:Find("highway") local highway = way.tags:Find("highway")
local name = way.tags:Find("name") local name = way.tags:Find("name")
local oneway = way.tags:Find("oneway") local oneway = way.tags:Find("oneway")
local route = way.tags:Find("route")
local duration = way.tags:Find("duration")
way.name = name way.name = name
if route ~= nil and durationIsValid(duration) then
way.ignore_in_grid = true
way.speed = math.max( 1, parseDuration(duration) / math.max(1, numberOfNodesInWay-1) )
way.is_duration_set = true
else
way.speed = speed_profile[highway] or speed_profile['default'] way.speed = speed_profile[highway] or speed_profile['default']
end
if oneway == "no" or oneway == "0" or oneway == "false" then if oneway == "no" or oneway == "0" or oneway == "false" then
way.direction = Way.bidirectional way.direction = Way.bidirectional