adding test for turn restrictions
This commit is contained in:
parent
a1a6b1b35f
commit
093b6c0217
22
features/bicycle.feature
Normal file
22
features/bicycle.feature
Normal file
@ -0,0 +1,22 @@
|
||||
@routing @bicycle
|
||||
Feature: Bicycle Routing from A to B
|
||||
To enable bicycle routing
|
||||
OSRM should handle all relevant bicycle tags
|
||||
|
||||
Scenario: Respect oneway without additional tags
|
||||
|
||||
Scenario: oneway:bicycle
|
||||
When I request a route from 55.673168935147,12.563557740441 to 55.67380116846,12.563107129324&
|
||||
Then I should get a route
|
||||
And the route should follow "Banegårdspladsen"
|
||||
And there should not be any turns
|
||||
And the distance should be close to 70m
|
||||
|
||||
Scenario: cycleway=opposite_lane
|
||||
When I request a route from 55.689236488,12.55317804955 to 55.688510764046,12.552909828648
|
||||
Then I should get a route
|
||||
And the route should follow "Kapelvej"
|
||||
And there should not be any turns
|
||||
And the distance should be close to 80m
|
||||
|
||||
|
||||
49
features/restrictions.feature
Normal file
49
features/restrictions.feature
Normal file
@ -0,0 +1,49 @@
|
||||
@routing @restrictions
|
||||
Feature: Turn restrictions
|
||||
OSRM should handle turn restrictions
|
||||
|
||||
Scenario: No left turn when crossing a oneway street
|
||||
When I request a route from 55.689741159238,12.574720202639 to 55.689741159232,12.57455927015
|
||||
Then I should get a route
|
||||
And the route should start at "Sølvgade"
|
||||
And the route should end at "Øster Farimagsgade"
|
||||
And the route should not include "Sølvgade, Øster Farimagsgade"
|
||||
And no error should be reported in terminal
|
||||
|
||||
Scenario: No left turn at T-junction: Don't turn left from side road into main road
|
||||
When I request a route from 55.66442995717,12.549384056343 to 55.664060815164,12.548944174065
|
||||
Then I should get a route
|
||||
And the route should start at "Sigerstedgade"
|
||||
And the route should end at "Ingerslevsgade"
|
||||
And there should be more than 1 turn
|
||||
And the route should not include "Sigerstedgade, Ingerslevsgade"
|
||||
|
||||
Scenario: No left turn at T-junction: OK to turn right from side road into main road
|
||||
When I request a route from 55.66442995717,12.549384056343 to 55.664218154805,12.5502638209
|
||||
Then I should get a route
|
||||
And the route should start at "Sigerstedgade"
|
||||
And the route should end at "Ingerslevsgade"
|
||||
And there should be 1 turn
|
||||
And the route should include "Sigerstedgade, Ingerslevsgade"
|
||||
|
||||
Scenario: No left turn at T-junction: OK to go straight on main road
|
||||
When I request a route from 55.66419092299,12.550333558335 to 55.664060815164,12.548944174065
|
||||
Then I should get a route
|
||||
And the route should stay on "Ingerslevsgade"
|
||||
|
||||
Scenario: No left turn at T-junction: OK to turn right from main road into side road
|
||||
When I request a route from 55.664060815164,12.548944174065 to 55.66442995717,12.549384056343
|
||||
Then I should get a route
|
||||
And the route should start at "Ingerslevsgade"
|
||||
And the route should end at "Sigerstedgade"
|
||||
And there should be 1 turn
|
||||
And the route should include "Ingerslevsgade, Sigerstedgade"
|
||||
|
||||
Scenario: No left turn at T-junction: OK to turn left from main road into side road
|
||||
When I request a route from 55.664218154805,12.5502638209 to 55.66442995717,12.549384056343
|
||||
Then I should get a route
|
||||
And the route should start at "Ingerslevsgade"
|
||||
And the route should end at "Sigerstedgade"
|
||||
And there should be 1 turn
|
||||
And the route should include "Ingerslevsgade, Sigerstedgade"
|
||||
|
||||
@ -15,27 +15,11 @@ Feature: Routing from A to B
|
||||
And the route should stay on "Islands Brygge"
|
||||
And the distance should be close to 200m
|
||||
|
||||
Scenario: Crossing round-about at Amalienborg
|
||||
Scenario: Crossing roundabout at Amalienborg
|
||||
When I request a route from 55.683797649183,12.593940686704 to 55.6842149924,12.592476200581
|
||||
Then I should get a route
|
||||
And the distance should be close to 150m
|
||||
|
||||
@bicycle
|
||||
Scenario: Handle cycleway=opposite_lane
|
||||
When I request a route from 55.689236488,12.55317804955 to 55.688510764046,12.552909828648
|
||||
Then I should get a route
|
||||
And the route should follow "Kapelvej"
|
||||
And there should not be any turns
|
||||
And the distance should be close to 80m
|
||||
|
||||
@bicycle
|
||||
Scenario: Handle oneway:bicycle
|
||||
When I request a route from 55.673168935147,12.563557740441 to 55.67380116846,12.563107129324&
|
||||
Then I should get a route
|
||||
And the route should follow "Banegårdspladsen"
|
||||
And there should not be any turns
|
||||
And the distance should be close to 70m
|
||||
|
||||
Scenario: Requesting invalid routes
|
||||
When I request a route from 0,0 to 0,0
|
||||
Then I should not get a route
|
||||
|
||||
@ -67,11 +67,11 @@ Then /^I should not get a route$/ do
|
||||
step "no route should be found"
|
||||
end
|
||||
|
||||
Then /^starting point should be "([^']*)"$/ do |name|
|
||||
Then /^the route should start at "([^']*)"$/ do |name|
|
||||
@json['route_summary']['start_point'].should == name
|
||||
end
|
||||
|
||||
Then /^end point should be "([^']*)"$/ do |name|
|
||||
Then /^the route should end at "([^']*)"$/ do |name|
|
||||
@json['route_summary']['end_point'].should == name
|
||||
end
|
||||
|
||||
@ -89,19 +89,50 @@ Then /^number of instructions should be (\d+)$/ do |n|
|
||||
@json['route_instructions'].size.should == n
|
||||
end
|
||||
|
||||
Then /^there should be 1 turn$/ do
|
||||
step 'there should be 1 turns'
|
||||
end
|
||||
|
||||
Then /^there should be (\d+) turns$/ do |n|
|
||||
@json['route_instructions'].map {|t| t.first}.select {|t| t =~ /^Turn/ }.size.should == n.to_i
|
||||
end
|
||||
|
||||
Then /^there should be more than (\d+) turn$/ do |n|
|
||||
@json['route_instructions'].map {|t| t.first}.select {|t| t =~ /^Turn/ }.size.should > n.to_i
|
||||
end
|
||||
|
||||
Then /^there should not be any turns$/ do
|
||||
(@json['route_instructions'].size-1).should == 0
|
||||
end
|
||||
|
||||
def sanitize_route route
|
||||
route.split(',').map{|w| w.strip}.reject(&:empty?).join(', ')
|
||||
end
|
||||
|
||||
def computed_route
|
||||
@json['route_instructions'].map { |r| r[1] }.reject(&:empty?).join(', ')
|
||||
end
|
||||
|
||||
Then /^the route should follow "([^"]*)"$/ do |route|
|
||||
route = route.split(',').map{|w| w.strip}.reject(&:empty?).join(', ')
|
||||
@json['route_instructions'].map { |r| r[1].strip }.reject(&:empty?).join(', ').should == route
|
||||
sanitize_route(route).should == computed_route
|
||||
end
|
||||
|
||||
Then /^the route should stay on "([^"]*)"$/ do |route|
|
||||
step 'starting point should be "Islands Brygge"'
|
||||
step 'end point should be "Islands Brygge"'
|
||||
step 'the route should follow "Islands Brygge"'
|
||||
step 'there should not be any turns'
|
||||
Then /^the route should not follow "([^"]*)"$/ do |route|
|
||||
sanitize_route(route).should_not == computed_route
|
||||
end
|
||||
|
||||
Then /^the route should include "([^"]*)"$/ do |route|
|
||||
sanitize_route(route).should =~ /#{computed_route}/
|
||||
end
|
||||
|
||||
Then /^the route should not include "([^"]*)"$/ do |route|
|
||||
sanitize_route(route).should_not =~ /#{computed_route}/
|
||||
end
|
||||
|
||||
Then /^the route should stay on "([^"]*)"$/ do |way|
|
||||
step "the route should start at \"#{way}\""
|
||||
step "the route should end at \"#{way}\""
|
||||
step "the route should follow \"#{way}\""
|
||||
step "there should not be any turns"
|
||||
end
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
pier = 5
|
||||
steps = 3
|
||||
obeyOneways = yes
|
||||
useRestrictions = no
|
||||
useRestrictions = yes
|
||||
accessTag = bicycle
|
||||
excludeFromGrid = ferry
|
||||
defaultSpeed = 15
|
||||
|
||||
Loading…
Reference in New Issue
Block a user