cucumber: enable checking mode in routability tables (#3748)

* cucumber: enable checking mode in routability tables

* show actual mode when expected was none

* minor fixes
This commit is contained in:
Emil Tin 2017-03-07 09:56:19 +01:00 committed by Daniel J. H
parent 65669f23a1
commit ee076e6156
7 changed files with 337 additions and 343 deletions

View File

@ -8,133 +8,120 @@ Feature: Bike - Access tags on ways
Scenario: Bike - Access tag hierarchy on ways Scenario: Bike - Access tag hierarchy on ways
Then routability should be Then routability should be
| highway | access | vehicle | bicycle | bothw | | highway | access | vehicle | bicycle | bothw |
| | | | | x | | primary | | | | cycling |
| | yes | | | x | | primary | yes | | | cycling |
| | no | | | | | primary | no | | | |
| | | yes | | x | | primary | | yes | | cycling |
| | | no | | | | primary | | no | | |
| | no | yes | | x | | primary | no | yes | | cycling |
| | yes | no | | | | primary | yes | no | | |
| | | | yes | x | | primary | | | yes | cycling |
| | | | no | | | primary | | | no | |
| | no | | yes | x | | primary | no | | yes | cycling |
| | yes | | no | | | primary | yes | | no | |
| | | no | yes | x | | primary | | no | yes | cycling |
| | | yes | no | | | primary | | yes | no | |
| runway | | | | |
| runway | yes | | | x |
| runway | no | | | |
| runway | | yes | | x |
| runway | | no | | |
| runway | no | yes | | x |
| runway | yes | no | | |
| runway | | | yes | x |
| runway | | | no | |
| runway | no | | yes | x |
| runway | yes | | no | |
| runway | | no | yes | x |
| runway | | yes | no | |
@todo @todo
Scenario: Bike - Access tag in forward direction Scenario: Bike - Access tag in forward direction
Then routability should be Then routability should be
| highway | access:forward | vehicle:forward | bicycle:forward | forw | backw | | highway | access:forward | vehicle:forward | bicycle:forward | forw | backw |
| | | | | x | | | primary | | | | cycling | |
| | yes | | | x | | | primary | yes | | | cycling | |
| | no | | | | | | primary | no | | | | |
| | | yes | | x | | | primary | | yes | | cycling | |
| | | no | | | | | primary | | no | | | |
| | no | yes | | x | | | primary | no | yes | | cycling | |
| | yes | no | | | | | primary | yes | no | | | |
| | | | yes | x | | | primary | | | yes | cycling | |
| | | | no | | | | primary | | | no | | |
| | no | | yes | x | | | primary | no | | yes | cycling | |
| | yes | | no | | | | primary | yes | | no | | |
| | | no | yes | x | | | primary | | no | yes | cycling | |
| | | yes | no | | | | primary | | yes | no | | |
| runway | | | | x | | | runway | | | | cycling | |
| runway | yes | | | x | | | runway | yes | | | cycling | |
| runway | no | | | | | | runway | no | | | | |
| runway | | yes | | x | | | runway | | yes | | cycling | |
| runway | | no | | | | | runway | | no | | | |
| runway | no | yes | | x | | | runway | no | yes | | cycling | |
| runway | yes | no | | | | | runway | yes | no | | | |
| runway | | | yes | x | | | runway | | | yes | cycling | |
| runway | | | no | | | | runway | | | no | | |
| runway | no | | yes | x | | | runway | no | | yes | cycling | |
| runway | yes | | no | | | | runway | yes | | no | | |
| runway | | no | yes | x | | | runway | | no | yes | cycling | |
| runway | | yes | no | | | | runway | | yes | no | | |
@todo @todo
Scenario: Bike - Access tag in backward direction Scenario: Bike - Access tag in backward direction
Then routability should be Then routability should be
| highway | access:forward | vehicle:forward | bicycle:forward | forw | backw | | highway | access:forward | vehicle:forward | bicycle:forward | forw | backw |
| | | | | | x | | primary | | | | | cycling |
| | yes | | | | x | | primary | yes | | | | cycling |
| | no | | | | | | primary | no | | | | |
| | | yes | | | x | | primary | | yes | | | cycling |
| | | no | | | | | primary | | no | | | |
| | no | yes | | | x | | primary | no | yes | | | cycling |
| | yes | no | | | | | primary | yes | no | | | |
| | | | yes | | x | | primary | | | yes | | cycling |
| | | | no | | | | primary | | | no | | |
| | no | | yes | | x | | primary | no | | yes | | cycling |
| | yes | | no | | | | primary | yes | | no | | |
| | | no | yes | | x | | primary | | no | yes | | cycling |
| | | yes | no | | | | primary | | yes | no | | |
| runway | | | | | x | | runway | | | | | cycling |
| runway | yes | | | | x | | runway | yes | | | | cycling |
| runway | no | | | | | | runway | no | | | | |
| runway | | yes | | | x | | runway | | yes | | | cycling |
| runway | | no | | | | | runway | | no | | | |
| runway | no | yes | | | x | | runway | no | yes | | | cycling |
| runway | yes | no | | | | | runway | yes | no | | | |
| runway | | | yes | | x | | runway | | | yes | | cycling |
| runway | | | no | | | | runway | | | no | | |
| runway | no | | yes | | x | | runway | no | | yes | | cycling |
| runway | yes | | no | | | | runway | yes | | no | | |
| runway | | no | yes | | x | | runway | | no | yes | | cycling |
| runway | | yes | no | | | | runway | | yes | no | | |
Scenario: Bike - Overwriting implied acccess on ways Scenario: Bike - Overwriting implied acccess on ways
Then routability should be Then routability should be
| highway | access | vehicle | bicycle | bothw | | highway | access | vehicle | bicycle | bothw |
| cycleway | | | | x | | cycleway | | | | cycling |
| runway | | | | | | runway | | | | |
| cycleway | no | | | | | cycleway | no | | | |
| cycleway | | no | | | | cycleway | | no | | |
| cycleway | | | no | | | cycleway | | | no | |
| runway | yes | | | x | | runway | yes | | | cycling |
| runway | | yes | | x | | runway | | yes | | cycling |
| runway | | | yes | x | | runway | | | yes | cycling |
Scenario: Bike - Access tags on ways Scenario: Bike - Access tags on ways
Then routability should be Then routability should be
| access | vehicle | bicycle | bothw | | access | vehicle | bicycle | bothw |
| | | | x | | | | | cycling |
| yes | | | x | | yes | | | cycling |
| permissive | | | x | | permissive | | | cycling |
| designated | | | x | | designated | | | cycling |
| some_tag | | | x | | some_tag | | | cycling |
| no | | | | | no | | | |
| private | | | | | private | | | |
| agricultural | | | | | agricultural | | | |
| forestry | | | | | forestry | | | |
| delivery | | | | | delivery | | | |
| | yes | | x | | | yes | | cycling |
| | permissive | | x | | | permissive | | cycling |
| | designated | | x | | | designated | | cycling |
| | some_tag | | x | | | some_tag | | cycling |
| | no | | | | | no | | |
| | private | | | | | private | | |
| | agricultural | | | | | agricultural | | |
| | forestry | | | | | forestry | | |
| | delivery | | | | | delivery | | |
| | | yes | x | | | | yes | cycling |
| | | permissive | x | | | | permissive | cycling |
| | | designated | x | | | | designated | cycling |
| | | some_tag | x | | | | some_tag | cycling |
| | | no | | | | | no | |
| | | private | | | | | private | |
| | | agricultural | | | | | agricultural | |
@ -144,23 +131,23 @@ Feature: Bike - Access tags on ways
Scenario: Bike - Access tags on both node and way Scenario: Bike - Access tags on both node and way
Then routability should be Then routability should be
| access | node/access | bothw | | access | node/access | bothw |
| yes | yes | x | | yes | yes | cycling |
| yes | no | | | yes | no | |
| yes | some_tag | x | | yes | some_tag | cycling |
| no | yes | | | no | yes | |
| no | no | | | no | no | |
| no | some_tag | | | no | some_tag | |
| some_tag | yes | x | | some_tag | yes | cycling |
| some_tag | no | | | some_tag | no | |
| some_tag | some_tag | x | | some_tag | some_tag | cycling |
Scenario: Bike - Access combinations Scenario: Bike - Access combinations
Then routability should be Then routability should be
| highway | access | vehicle | bicycle | forw | backw | | highway | access | vehicle | bicycle | forw | backw |
| runway | private | | yes | x | x | | runway | private | | yes | cycling | cycling |
| footway | | no | permissive | x | x | | footway | | no | permissive | cycling | cycling |
| motorway | | | yes | x | | | motorway | | | yes | cycling | |
| track | forestry | | permissive | x | x | | track | forestry | | permissive | cycling | cycling |
| cycleway | yes | designated | no | | | | cycleway | yes | designated | no | | |
| primary | | yes | private | | | | primary | | yes | private | | |
| residential | permissive | | no | | | | residential | permissive | | no | | |
@ -169,31 +156,30 @@ Feature: Bike - Access tags on ways
Then routability should be Then routability should be
| highway | boat | motor_vehicle | moped | bothw | | highway | boat | motor_vehicle | moped | bothw |
| river | yes | | | | | river | yes | | | |
| cycleway | no | | | x | | cycleway | no | | | cycling |
| runway | | yes | | | | runway | | yes | | |
| cycleway | | no | | x | | cycleway | | no | | cycling |
| runway | | | yes | | | runway | | | yes | |
| cycleway | | | no | x | | cycleway | | | no | cycling |
Scenario: Bike - Bridleways when access is explicit Scenario: Bike - Bridleways when access is explicit
Then routability should be Then routability should be
| highway | horse | foot | bicycle | bothw | | highway | horse | foot | bicycle | bothw |
| bridleway | | | yes | x | | bridleway | | | yes | cycling |
| bridleway | | yes | | x | | bridleway | | yes | | pushing bike |
| bridleway | designated | | | | | bridleway | designated | | | |
| bridleway | | | | | | bridleway | | | | |
Scenario: Bike - Tram with oneway when access is implicit Scenario: Bike - Tram with oneway when access is implicit
Then routability should be Then routability should be
| highway | railway | access | oneway | bothw | | highway | railway | access | oneway | forw | backw |
| residential | tram | | yes | x | | residential | tram | | yes | cycling | pushing bike |
| service | tram | psv | yes | x | | service | tram | psv | yes | cycling | pushing bike |
Scenario: Bike - Access combinations Scenario: Bike - Access combinations
Then routability should be Then routability should be
| highway | access | bothw | | highway | access | bothw |
| primary | permissive | x | | primary | permissive | cycling |
| steps | permissive | x | | steps | permissive | cycling |
| footway | permissive | x | | footway | permissive | cycling |
| garbagetag | permissive | x | | garbagetag | permissive | cycling |

View File

@ -8,25 +8,25 @@ Feature: Bike - Access tags on nodes
Scenario: Bike - Access tag hierarchy on nodes Scenario: Bike - Access tag hierarchy on nodes
Then routability should be Then routability should be
| node/access | node/vehicle | node/bicycle | node/highway | bothw | | node/access | node/vehicle | node/bicycle | node/highway | bothw |
| | | | | x | | | | | | cycling |
| yes | | | | x | | yes | | | | cycling |
| no | | | | | | no | | | | |
| | yes | | | x | | | yes | | | cycling |
| | no | | | | | | no | | | |
| no | yes | | | x | | no | yes | | | cycling |
| yes | no | | | | | yes | no | | | |
| | | yes | | x | | | | yes | | cycling |
| | | no | | | | | | no | | |
| | | no | crossing | x | | | | no | crossing | cycling |
| no | | yes | | x | | no | | yes | | cycling |
| yes | | no | | | | yes | | no | | |
| | no | yes | | x | | | no | yes | | cycling |
| | yes | no | | | | | yes | no | | |
Scenario: Bike - Overwriting implied acccess on nodes doesn't overwrite way Scenario: Bike - Overwriting implied acccess on nodes doesn't overwrite way
Then routability should be Then routability should be
| highway | node/access | node/vehicle | node/bicycle | bothw | | highway | node/access | node/vehicle | node/bicycle | bothw |
| cycleway | | | | x | | cycleway | | | | cycling |
| runway | | | | | | runway | | | | |
| cycleway | no | | | | | cycleway | no | | | |
| cycleway | | no | | | | cycleway | | no | | |
@ -38,29 +38,29 @@ Feature: Bike - Access tags on nodes
Scenario: Bike - Access tags on nodes Scenario: Bike - Access tags on nodes
Then routability should be Then routability should be
| node/access | node/vehicle | node/bicycle | bothw | | node/access | node/vehicle | node/bicycle | bothw |
| | | | x | | | | | cycling |
| yes | | | x | | yes | | | cycling |
| permissive | | | x | | permissive | | | cycling |
| designated | | | x | | designated | | | cycling |
| some_tag | | | x | | some_tag | | | cycling |
| no | | | | | no | | | |
| private | | | | | private | | | |
| agricultural | | | | | agricultural | | | |
| forestry | | | | | forestry | | | |
| delivery | | | | | delivery | | | |
| | yes | | x | | | yes | | cycling |
| | permissive | | x | | | permissive | | cycling |
| | designated | | x | | | designated | | cycling |
| | some_tag | | x | | | some_tag | | cycling |
| | no | | | | | no | | |
| | private | | | | | private | | |
| | agricultural | | | | | agricultural | | |
| | forestry | | | | | forestry | | |
| | delivery | | | | | delivery | | |
| | | yes | x | | | | yes | cycling |
| | | permissive | x | | | | permissive | cycling |
| | | designated | x | | | | designated | cycling |
| | | some_tag | x | | | | some_tag | cycling |
| | | no | | | | | no | |
| | | private | | | | | private | |
| | | agricultural | | | | | agricultural | |

View File

@ -9,12 +9,14 @@ Feature: Bike - Oneway streets
Scenario: Bike - Simple oneway Scenario: Bike - Simple oneway
Then routability should be Then routability should be
| highway | foot | oneway | forw | backw | | highway | foot | oneway | forw | backw |
| primary | no | yes | x | | | primary | no | yes | cycling | |
| primary | | yes | cycling | pushing bike |
Scenario: Simple reverse oneway Scenario: Simple reverse oneway
Then routability should be Then routability should be
| highway | foot | oneway | forw | backw | | highway | foot | oneway | forw | backw |
| primary | no | -1 | | x | | primary | no | -1 | | cycling |
| primary | | -1 | pushing bike | cycling |
Scenario: Bike - Around the Block Scenario: Bike - Around the Block
Given the node map Given the node map
@ -40,82 +42,82 @@ Feature: Bike - Oneway streets
Scenario: Bike - Handle various oneway tag values Scenario: Bike - Handle various oneway tag values
Then routability should be Then routability should be
| foot | oneway | forw | backw | | foot | oneway | forw | backw |
| no | | x | x | | no | | cycling | cycling |
| no | nonsense | x | x | | no | nonsense | cycling | cycling |
| no | no | x | x | | no | no | cycling | cycling |
| no | false | x | x | | no | false | cycling | cycling |
| no | 0 | x | x | | no | 0 | cycling | cycling |
| no | yes | x | | | no | yes | cycling | |
| no | true | x | | | no | true | cycling | |
| no | 1 | x | | | no | 1 | cycling | |
| no | -1 | | x | | no | -1 | | cycling |
Scenario: Bike - Implied oneways Scenario: Bike - Implied oneways
Then routability should be Then routability should be
| highway | foot | bicycle | junction | forw | backw | # | | highway | foot | bicycle | junction | forw | backw | # |
| | no | | | x | x | | | | no | | | cycling | cycling | |
| | no | | roundabout | x | | | | | no | | roundabout | cycling | | |
| motorway | no | yes | | x | | | | motorway | no | yes | | cycling | | |
| motorway_link | no | yes | | x | x | does not imply oneway | | motorway_link | no | yes | | cycling | cycling | does not imply oneway |
| motorway | no | yes | roundabout | x | | | | motorway | no | yes | roundabout | cycling | | |
| motorway_link | no | yes | roundabout | x | | | | motorway_link | no | yes | roundabout | cycling | | |
Scenario: Bike - Overriding implied oneways Scenario: Bike - Overriding implied oneways
Then routability should be Then routability should be
| highway | foot | junction | oneway | forw | backw | | highway | foot | junction | oneway | forw | backw |
| primary | no | roundabout | no | x | x | | primary | no | roundabout | no | cycling | cycling |
| primary | no | roundabout | yes | x | | | primary | no | roundabout | yes | cycling | |
| motorway_link | no | | -1 | | | | motorway_link | no | | -1 | | |
| trunk_link | no | | -1 | | | | trunk_link | no | | -1 | | |
| primary | no | roundabout | -1 | | x | | primary | no | roundabout | -1 | | cycling |
Scenario: Bike - Oneway:bicycle should override normal oneways tags Scenario: Bike - Oneway:bicycle should override normal oneways tags
Then routability should be Then routability should be
| foot | oneway:bicycle | oneway | junction | forw | backw | | foot | oneway:bicycle | oneway | junction | forw | backw |
| no | yes | | | x | | | no | yes | | | cycling | |
| no | yes | yes | | x | | | no | yes | yes | | cycling | |
| no | yes | no | | x | | | no | yes | no | | cycling | |
| no | yes | -1 | | x | | | no | yes | -1 | | cycling | |
| no | yes | | roundabout | x | | | no | yes | | roundabout | cycling | |
| no | no | | | x | x | | no | no | | | cycling | cycling |
| no | no | yes | | x | x | | no | no | yes | | cycling | cycling |
| no | no | no | | x | x | | no | no | no | | cycling | cycling |
| no | no | -1 | | x | x | | no | no | -1 | | cycling | cycling |
| no | no | | roundabout | x | x | | no | no | | roundabout | cycling | cycling |
| no | -1 | | | | x | | no | -1 | | | | cycling |
| no | -1 | yes | | | x | | no | -1 | yes | | | cycling |
| no | -1 | no | | | x | | no | -1 | no | | | cycling |
| no | -1 | -1 | | | x | | no | -1 | -1 | | | cycling |
| no | -1 | | roundabout | | x | | no | -1 | | roundabout | | cycling |
Scenario: Bike - Contra flow Scenario: Bike - Contra flow
Then routability should be Then routability should be
| foot | oneway | cycleway | forw | backw | | foot | oneway | cycleway | forw | backw |
| no | yes | opposite | x | x | | no | yes | opposite | cycling | cycling |
| no | yes | opposite_track | x | x | | no | yes | opposite_track | cycling | cycling |
| no | yes | opposite_lane | x | x | | no | yes | opposite_lane | cycling | cycling |
| no | -1 | opposite | x | x | | no | -1 | opposite | cycling | cycling |
| no | -1 | opposite_track | x | x | | no | -1 | opposite_track | cycling | cycling |
| no | -1 | opposite_lane | x | x | | no | -1 | opposite_lane | cycling | cycling |
| no | no | opposite | x | x | | no | no | opposite | cycling | cycling |
| no | no | opposite_track | x | x | | no | no | opposite_track | cycling | cycling |
| no | no | opposite_lane | x | x | | no | no | opposite_lane | cycling | cycling |
Scenario: Bike - Should not be affected by car tags Scenario: Bike - Should not be affected by car tags
Then routability should be Then routability should be
| foot | junction | oneway | oneway:car | forw | backw | | foot | junction | oneway | oneway:car | forw | backw |
| no | | yes | yes | x | | | no | | yes | yes | cycling | |
| no | | yes | no | x | | | no | | yes | no | cycling | |
| no | | yes | -1 | x | | | no | | yes | -1 | cycling | |
| no | | no | yes | x | x | | no | | no | yes | cycling | cycling |
| no | | no | no | x | x | | no | | no | no | cycling | cycling |
| no | | no | -1 | x | x | | no | | no | -1 | cycling | cycling |
| no | | -1 | yes | | x | | no | | -1 | yes | | cycling |
| no | | -1 | no | | x | | no | | -1 | no | | cycling |
| no | | -1 | -1 | | x | | no | | -1 | -1 | | cycling |
| no | roundabout | | yes | x | | | no | roundabout | | yes | cycling | |
| no | roundabout | | no | x | | | no | roundabout | | no | cycling | |
| no | roundabout | | -1 | x | | | no | roundabout | | -1 | cycling | |
Scenario: Bike - Two consecutive oneways Scenario: Bike - Two consecutive oneways
Given the node map Given the node map

View File

@ -3,34 +3,30 @@ Feature: Bike - Accessability of different way types
Background: Background:
Given the profile "bicycle" Given the profile "bicycle"
Given the shortcuts
| key | value |
| bike | 15 km/h ~20% |
| foot | 5 km/h ~20% |
Scenario: Bike - Pushing bikes on pedestrian-only ways Scenario: Bike - Pushing bikes on pedestrian-only ways
Then routability should be Then routability should be
| highway | oneway | forw | backw | | highway | oneway | forw | backw |
| (nil) | | | | | (nil) | | | |
| cycleway | | bike | bike | | cycleway | | cycling | cycling |
| primary | | bike | bike | | primary | | cycling | cycling |
| pedestrian | | foot | foot | | pedestrian | | pushing bike | pushing bike |
| footway | | foot | foot | | cycleway | | cycling | cycling |
| primary | yes | bike | foot | | primary | yes | cycling | pushing bike |
Scenario: Bike - Pushing bikes against normal oneways Scenario: Bike - Pushing bikes against normal oneways
Then routability should be Then routability should be
| highway | oneway | forw | backw | | highway | oneway | forw | backw |
| (nil) | | | | | (nil) | | | |
| primary | yes | bike | foot | | primary | yes | cycling | pushing bike |
| pedestrian | yes | foot | foot | | pedestrian | yes | pushing bike | pushing bike |
Scenario: Bike - Pushing bikes against reverse oneways Scenario: Bike - Pushing bikes against reverse oneways
Then routability should be Then routability should be
| highway | oneway | forw | backw | | highway | oneway | forw | backw |
| (nil) | | | | | (nil) | | | |
| primary | -1 | foot | bike | | primary | -1 | pushing bike | cycling |
| pedestrian | -1 | foot | foot | | pedestrian | -1 | pushing bike | pushing bike |
@square @square
Scenario: Bike - Push bikes on pedestrian areas Scenario: Bike - Push bikes on pedestrian areas
@ -61,17 +57,17 @@ Feature: Bike - Accessability of different way types
Then routability should be Then routability should be
| highway | foot | forw | backw | | highway | foot | forw | backw |
| motorway | | | | | motorway | | | |
| motorway | yes | foot | | | motorway | yes | pushing bike | |
| runway | | | | | runway | | | |
| runway | yes | foot | foot | | runway | yes | pushing bike | pushing bike |
@todo @todo
Scenario: Bike - Pushing bikes on ways with foot=yes in one direction Scenario: Bike - Pushing bikes on ways with foot=yes in one direction
Then routability should be Then routability should be
| highway | foot:forward | foot:backward | forw | backw | | highway | foot:forward | foot:backward | forw | backw |
| motorway | | | | | | motorway | | | | |
| motorway | yes | | foot | | | motorway | yes | | pushing bike | |
| motorway | | yes | | foot | | motorway | | yes | | pushing bike |
@construction @construction
Scenario: Bike - Don't allow routing on ways still under construction Scenario: Bike - Don't allow routing on ways still under construction

View File

@ -8,32 +8,32 @@ Feature: Bike - Handle ferry routes
Scenario: Bike - Bringing bikes on trains Scenario: Bike - Bringing bikes on trains
Then routability should be Then routability should be
| highway | railway | bicycle | bothw | | highway | railway | bicycle | bothw |
| primary | | | x | | primary | | | cycling |
| (nil) | train | | | | (nil) | train | | |
| (nil) | train | no | | | (nil) | train | no | |
| (nil) | train | yes | x | | (nil) | train | yes | train |
| (nil) | railway | | | | (nil) | railway | | |
| (nil) | railway | no | | | (nil) | railway | no | |
| (nil) | railway | yes | x | | (nil) | railway | yes | train |
| (nil) | subway | | | | (nil) | subway | | |
| (nil) | subway | no | | | (nil) | subway | no | |
| (nil) | subway | yes | x | | (nil) | subway | yes | train |
| (nil) | tram | | | | (nil) | tram | | |
| (nil) | tram | no | | | (nil) | tram | no | |
| (nil) | tram | yes | x | | (nil) | tram | yes | train |
| (nil) | light_rail | | | | (nil) | light_rail | | |
| (nil) | light_rail | no | | | (nil) | light_rail | no | |
| (nil) | light_rail | yes | x | | (nil) | light_rail | yes | train |
| (nil) | monorail | | | | (nil) | monorail | | |
| (nil) | monorail | no | | | (nil) | monorail | no | |
| (nil) | monorail | yes | x | | (nil) | monorail | yes | train |
| (nil) | some_tag | | | | (nil) | some_tag | | |
| (nil) | some_tag | no | | | (nil) | some_tag | no | |
| (nil) | some_tag | yes | x | | (nil) | some_tag | yes | cycling |
@construction @construction
Scenario: Bike - Don't route on railways under construction Scenario: Bike - Don't route on railways under construction
Then routability should be Then routability should be
| highway | railway | bicycle | bothw | | highway | railway | bicycle | bothw |
| primary | | | x | | primary | | | cycling |
| (nil) | construction | yes | | | (nil) | construction | yes | |

View File

@ -10,7 +10,7 @@ module.exports = function () {
headers = new Set(Object.keys(table.hashes()[0])); headers = new Set(Object.keys(table.hashes()[0]));
if (!testedHeaders.some(k => !!headers.has(k))) { if (!testedHeaders.some(k => !!headers.has(k))) {
throw new Error('*** routability table must contain either "forw", "backw", "bothw", "forw_rate" or "backw_rate" column'); throw new Error('*** routability table must contain either "forw", "backw", "bothw", "forw_rate" or "backw_mode" column');
} }
this.reprocessAndLoadData((e) => { this.reprocessAndLoadData((e) => {
@ -62,9 +62,12 @@ module.exports = function () {
// rename forw/backw to forw/backw_speed // rename forw/backw to forw/backw_speed
switch (true) { switch (true) {
case '' === want: case '' === want:
outputRow[direction] = result[direction].status ?
result[direction].mode : '';
break;
case 'x' === want: case 'x' === want:
outputRow[direction] = result[direction].status ? outputRow[direction] = result[direction].status ?
result[direction].status.toString() : ''; 'x' : '';
break; break;
case /^[\d\.]+ s/.test(want): case /^[\d\.]+ s/.test(want):
// the result here can come back as a non-number value like // the result here can come back as a non-number value like
@ -88,7 +91,7 @@ module.exports = function () {
} }
break; break;
default: default:
throw new Error(util.format('*** Unknown expectation format: %s', want)); outputRow[direction] = result[direction].mode || '';
} }
if (this.FuzzyMatch.match(outputRow[direction], want)) { if (this.FuzzyMatch.match(outputRow[direction], want)) {
@ -106,7 +109,7 @@ module.exports = function () {
// makes simple a-b request using the given cucumber test routability conditions // makes simple a-b request using the given cucumber test routability conditions
// result is an object containing the calculated values for 'rate', 'status', // result is an object containing the calculated values for 'rate', 'status',
// 'time', 'distance', and 'speed' for forwards and backwards routing, as well as // 'time', 'distance', 'speed' and 'mode', for forwards and backwards routing, as well as
// a bothw object that diffs forwards/backwards // a bothw object that diffs forwards/backwards
var testRoutabilityRow = (i, cb) => { var testRoutabilityRow = (i, cb) => {
var result = {}; var result = {};
@ -133,6 +136,13 @@ module.exports = function () {
r.distance = r.json.routes[0].distance; r.distance = r.json.routes[0].distance;
r.rate = Math.round(r.distance / r.json.routes[0].weight); r.rate = Math.round(r.distance / r.json.routes[0].weight);
r.speed = r.time > 0 ? parseInt(3.6 * r.distance / r.time) : null; r.speed = r.time > 0 ? parseInt(3.6 * r.distance / r.time) : null;
// use the mode of the first step of the route
// for routability table test, we can assume the mode is the same throughout the route,
// since the route is just a single way
if( r.json.routes[0].legs[0] && r.json.routes[0].legs[0].steps[0] ) {
r.mode = r.json.routes[0].legs[0].steps[0].mode;
}
} else { } else {
r.status = null; r.status = null;
} }
@ -167,7 +177,7 @@ module.exports = function () {
scb(); scb();
}; };
['rate', 'status', 'time', 'distance', 'speed'].forEach((key) => { ['rate', 'status', 'time', 'distance', 'speed' ,'mode'].forEach((key) => {
sq.defer(parseRes, key); sq.defer(parseRes, key);
}); });