handle startpoint in bicycle profile, add tests

This commit is contained in:
Emil Tin 2017-07-06 13:57:07 +02:00 committed by Patrick Niklaus
parent 54ceb05420
commit 0bfbe5ad16
6 changed files with 193 additions and 32 deletions

View File

@ -65,5 +65,5 @@ Feature: Bike - Handle ferry routes
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | d | abcd,abcd | 3600s | | a | d | abcd,abcd | 3600s +-5 |
| d | a | abcd,abcd | 3600s | | d | a | abcd,abcd | 3600s +-5 |

View File

@ -0,0 +1,53 @@
@routing @bicycle @startpoint
Feature: Bike - Allowed start/end modes
Background:
Given the profile "bicycle"
Scenario: Bike - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | cycling,cycling |
| 2 | 1 | ab,ab | cycling,cycling |
Scenario: Bike - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | cycling,cycling |
| 2 | 1 | ab,ab | cycling,cycling |
Scenario: Bike - OK to start pushing bike
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway |
| ab | primary |
| bc | steps |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,bc,bc | cycling,pushing bike,pushing bike |
| 2 | 1 | bc,ab,ab | pushing bike,cycling,cycling |

View File

@ -1,39 +1,71 @@
@routing @bicycle @train @routing @bicycle @train
Feature: Bike - Handle ferry routes Feature: Bike - Handle ferry routes
# Bringing bikes on trains and subways # Bringing bikes on trains and subways
# We cannot currently use a 'routability' type test, since the bike
# profile does not allow starting/stopping on trains, and
# it's not possible to modify the bicycle profile table because it's
# defined as local.
Background: Background:
Given the profile "bicycle" Given the profile "bicycle"
Scenario: Bike - Bringing bikes on trains Scenario: Bike - Bringing bikes on trains
Then routability should be Given the node map
| highway | railway | bicycle | bothw | """
| primary | | | cycling | a 1 b c 2 d e 3 f g 4 h
| (nil) | train | | | """
| (nil) | train | no | |
| (nil) | train | yes | train | And the ways
| (nil) | railway | | | | nodes | highway | railway | bicycle |
| (nil) | railway | no | | | ab | primary | | |
| (nil) | railway | yes | train | | cd | primary | | |
| (nil) | subway | | | | ef | primary | | |
| (nil) | subway | no | | | gh | primary | | |
| (nil) | subway | yes | train | | bc | | train | |
| (nil) | tram | | | | de | | train | yes |
| (nil) | tram | no | | | fg | | train | no |
| (nil) | tram | yes | train |
| (nil) | light_rail | | | When I route I should get
| (nil) | light_rail | no | | | from | to | route |
| (nil) | light_rail | yes | train | | 1 | 2 | |
| (nil) | monorail | | | | 2 | 3 | cd,de,ef,ef |
| (nil) | monorail | no | | | 3 | 4 | |
| (nil) | monorail | yes | train |
| (nil) | some_tag | | | Scenario: Bike - Bringing bikes on trains, invalid railway tag is accepted if access specified
| (nil) | some_tag | no | | Given the node map
| (nil) | some_tag | yes | cycling | """
a 1 b c 2 d e 3 f g 4 h
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| cd | primary | | |
| ef | primary | | |
| gh | primary | | |
| bc | | invalid_tag | |
| de | | invalid_tag | yes |
| fg | | invalid_tag | no |
When I route I should get
| from | to | route |
| 1 | 2 | |
| 2 | 3 | cd,de,ef|
| 3 | 4 | |
@construction @construction
Scenario: Bike - Don't route on railways under construction Scenario: Bike - Don't route on railways under construction
Then routability should be Given the node map
| highway | railway | bicycle | bothw | """
| primary | | | cycling | a 1 b c 2 d
| (nil) | construction | yes | | """
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| cd | primary | | |
| bc | | construction | yes |
When I route I should get
| from | to | route |
| 1 | 2 | |

View File

@ -0,0 +1,37 @@
@routing @car @startpoint
Feature: Car - Allowed start/end modes
Background:
Given the profile "car"
Scenario: Car - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |
Scenario: Car - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |

View File

@ -0,0 +1,37 @@
@routing @foot @startpoint
Feature: Foot - Allowed start/end modes
Background:
Given the profile "foot"
Scenario: Foot - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | walking,walking |
| 2 | 1 | ab,ab | walking,walking |
Scenario: Foot - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | walking,walking |
| 2 | 1 | ab,ab | walking,walking |

View File

@ -543,7 +543,9 @@ function way_function (way, result)
-- handle various other flags -- handle various other flags
'handle_roundabouts', 'handle_roundabouts',
--'handle_startpoint',
-- handle allowed start/end modes
'handle_startpoint',
-- set name, ref and pronunciation -- set name, ref and pronunciation
'handle_names' 'handle_names'