Skip to content

Commit

Permalink
cucumber cleanup, removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Tin committed Dec 16, 2012
1 parent 7e9614b commit ec56478
Show file tree
Hide file tree
Showing 51 changed files with 187 additions and 349 deletions.
2 changes: 1 addition & 1 deletion features/bicycle/access.feature
Expand Up @@ -3,7 +3,7 @@ Feature: Bike - Restricted access
Reference: http://wiki.openstreetmap.org/wiki/Key:access Reference: http://wiki.openstreetmap.org/wiki/Key:access


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Access tag hierachy on ways Scenario: Bike - Access tag hierachy on ways
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/area.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Bike - Squares and other areas Feature: Bike - Squares and other areas


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


@square @square
Scenario: Bike - Route along edge of a squares Scenario: Bike - Route along edge of a squares
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/barrier.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Barriers Feature: Barriers


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Barriers Scenario: Bike - Barriers
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/cycleway.feature
Expand Up @@ -3,7 +3,7 @@ Feature: Bike - Cycle tracks/lanes
Reference: http://wiki.openstreetmap.org/wiki/Key:cycleway Reference: http://wiki.openstreetmap.org/wiki/Key:cycleway


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Cycle tracks/lanes should enable biking Scenario: Bike - Cycle tracks/lanes should enable biking
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/destination.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Bike - Destination only, no passing through Feature: Bike - Destination only, no passing through


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Destination only street Scenario: Bike - Destination only street
Given the node map Given the node map
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/ferry.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Bike - Handle ferry routes Feature: Bike - Handle ferry routes


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Ferry route Scenario: Bike - Ferry route
Given the node map Given the node map
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/maxspeed.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Bike - Max speed restrictions Feature: Bike - Max speed restrictions


Background: Use specific speeds Background: Use specific speeds
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Respect maxspeeds when lower that way type speed Scenario: Bike - Respect maxspeeds when lower that way type speed
Given the node map Given the node map
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/names.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Bike - Street names in instructions Feature: Bike - Street names in instructions


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - A named street Scenario: Bike - A named street
Given the node map Given the node map
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/oneway.feature
Expand Up @@ -3,7 +3,7 @@ Feature: Bike - Oneway streets
Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Simple oneway Scenario: Bike - Simple oneway
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/restrictions.feature
Expand Up @@ -4,7 +4,7 @@ Feature: Bike - Turn restrictions
Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes. Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes.


Background: Use car routing Background: Use car routing
Given the speedprofile "bicycle" Given the profile "bicycle"


@no_turning @no_turning
Scenario: Bike - No left turn Scenario: Bike - No left turn
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/stop_area.feature
Expand Up @@ -4,7 +4,7 @@ Platforms and railway/bus lines are connected using a relation rather that a way
http://wiki.openstreetmap.org/wiki/Tag:public_transport%3Dstop_area http://wiki.openstreetmap.org/wiki/Tag:public_transport%3Dstop_area


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Platforms tagged using public_transport Scenario: Bike - Platforms tagged using public_transport
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/bicycle/train.feature
Expand Up @@ -3,7 +3,7 @@ Feature: Bike - Handle ferry routes
Bringing bikes on trains and subways Bringing bikes on trains and subways


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Bringing bikes on trains Scenario: Bike - Bringing bikes on trains
Then routability should be Then routability should be
Expand Down
4 changes: 2 additions & 2 deletions features/bicycle/way.feature
Expand Up @@ -2,11 +2,11 @@
Feature: Bike - Accessability of different way types Feature: Bike - Accessability of different way types


Background: Background:
Given the speedprofile "bicycle" Given the profile "bicycle"


Scenario: Bike - Basic access Scenario: Bike - Basic access
Bikes are allowed on footways etc because you can pull your bike at a lower speed. Bikes are allowed on footways etc because you can pull your bike at a lower speed.
Given the speedprofile "bicycle" Given the profile "bicycle"
Then routability should be Then routability should be
| highway | forw | | highway | forw |
| (nil) | | | (nil) | |
Expand Down
2 changes: 1 addition & 1 deletion features/car/access.feature
Expand Up @@ -3,7 +3,7 @@ Feature: Car - Restricted access
Reference: http://wiki.openstreetmap.org/wiki/Key:access Reference: http://wiki.openstreetmap.org/wiki/Key:access


Background: Background:
Given the speedprofile "car" Given the profile "car"


Scenario: Car - Access tag hierachy on ways Scenario: Car - Access tag hierachy on ways
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/car/barrier.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Car - Barriers Feature: Car - Barriers


Background: Background:
Given the speedprofile "car" Given the profile "car"


Scenario: Car - Barriers Scenario: Car - Barriers
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/car/destination.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Car - Destination only, no passing through Feature: Car - Destination only, no passing through


Background: Background:
Given the speedprofile "car" Given the profile "car"


Scenario: Car - Destination only street Scenario: Car - Destination only street
Given the node map Given the node map
Expand Down
2 changes: 1 addition & 1 deletion features/car/ferry.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Car - Handle ferry routes Feature: Car - Handle ferry routes


Background: Background:
Given the speedprofile "car" Given the profile "car"


Scenario: Car - Use a ferry route Scenario: Car - Use a ferry route
Given the node map Given the node map
Expand Down
2 changes: 1 addition & 1 deletion features/car/maxspeed.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Car - Max speed restrictions Feature: Car - Max speed restrictions


Background: Use specific speeds Background: Use specific speeds
Given the speedprofile "car" Given the profile "car"
Given a grid size of 1000 meters Given a grid size of 1000 meters


Scenario: Car - Respect maxspeeds when lower that way type speed Scenario: Car - Respect maxspeeds when lower that way type speed
Expand Down
2 changes: 1 addition & 1 deletion features/car/names.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Car - Street names in instructions Feature: Car - Street names in instructions


Background: Background:
Given the speedprofile "car" Given the profile "car"


Scenario: Car - A named street Scenario: Car - A named street
Given the node map Given the node map
Expand Down
2 changes: 1 addition & 1 deletion features/car/oneway.feature
Expand Up @@ -3,7 +3,7 @@ Feature: Car - Oneway streets
Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing


Background: Background:
Given the speedprofile "car" Given the profile "car"


Scenario: Car - Simple oneway Scenario: Car - Simple oneway
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/car/restrictions.feature
Expand Up @@ -4,7 +4,7 @@ Feature: Car - Turn restrictions
Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes. Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes.


Background: Use car routing Background: Use car routing
Given the speedprofile "car" Given the profile "car"


@no_turning @no_turning
Scenario: Car - No left turn Scenario: Car - No left turn
Expand Down
2 changes: 1 addition & 1 deletion features/car/way.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Car - Accessability of different way types Feature: Car - Accessability of different way types


Background: Background:
Given the speedprofile "car" Given the profile "car"


Scenario: Car - Basic access Scenario: Car - Basic access
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/foot/oneway.feature
Expand Up @@ -3,7 +3,7 @@ Feature: Foot - Oneway streets
Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing


Background: Background:
Given the speedprofile "foot" Given the profile "foot"


Scenario: Foot - Walking should not be affected by oneways Scenario: Foot - Walking should not be affected by oneways
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/foot/way.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Foot - Accessability of different way types Feature: Foot - Accessability of different way types


Background: Background:
Given the speedprofile "foot" Given the profile "foot"


Scenario: Foot - Basic access Scenario: Foot - Basic access
Then routability should be Then routability should be
Expand Down
2 changes: 1 addition & 1 deletion features/investigate/weird.feature
Expand Up @@ -2,7 +2,7 @@
Feature: Weird routings discovered Feature: Weird routings discovered


Background: Background:
Given the speedprofile "testbot" Given the profile "testbot"


Scenario: Routing on a oneway roundabout Scenario: Routing on a oneway roundabout
Given the node map Given the node map
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/data.rb
@@ -1,5 +1,5 @@
Given /^the speedprofile "([^"]*)"$/ do |profile| Given /^the profile "([^"]*)"$/ do |profile|
read_speedprofile profile set_profile profile
end end


Given /^a grid size of (\d+) meters$/ do |meters| Given /^a grid size of (\d+) meters$/ do |meters|
Expand Down
14 changes: 0 additions & 14 deletions features/step_definitions/errors.rb

This file was deleted.

74 changes: 0 additions & 74 deletions features/step_definitions/processing.rb

This file was deleted.

22 changes: 22 additions & 0 deletions features/step_definitions/requests.rb
Expand Up @@ -21,3 +21,25 @@
@json['transactionId'].class.should == String @json['transactionId'].class.should == String
end end


Then /^response should be a well-formed route$/ do
step "response should be well-formed"
@json['status_message'].class.should == String
@json['route_summary'].class.should == Hash
@json['route_geometry'].class.should == String
@json['route_instructions'].class.should == Array
@json['via_points'].class.should == Array
end

When /^I preprocess data$/ do
begin
reprocess
rescue OSRMError => e
@process_error = e
end
end

Then /^preparing should return code (\d+)$/ do |code|
@process_error.class.should == OSRMError
@process_error.process.should == 'osrm-prepare'
@process_error.code.to_i.should == code.to_i
end
40 changes: 40 additions & 0 deletions features/step_definitions/routability.rb
@@ -0,0 +1,40 @@
Then /^routability should be$/ do |table|
build_ways_from_table table
reprocess
actual = []
if table.headers&["forw","backw","bothw"] == []
raise "*** routability tabel must contain either 'forw', 'backw' or 'bothw' column"
end
OSRMLauncher.new do
table.hashes.each_with_index do |row,i|
got = row.dup
attempts = []
['forw','backw','bothw'].each do |direction|
if table.headers.include? direction
if direction == 'forw' || direction == 'bothw'
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(3+WAY_SPACING*i)*@zoom}")
elsif direction == 'backw' || direction == 'bothw'
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(3+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}")
end
got[direction] = route_status response
json = JSON.parse(response.body)
if got[direction].empty? == false
route = way_list json['route_instructions']
if route != "w#{i}"
got[direction] = "testing w#{i}, but got #{route}!?"
elsif row[direction] =~ /\d+s/
time = json['route_summary']['total_time']
got[direction] = "#{time}s"
end
end
if got[direction] != row[direction]
attempts << { :attempt => direction, :query => @query, :response => response }
end
end
end
log_fail row,got,attempts if got != row
actual << got
end
end
table.routing_diff! actual
end

0 comments on commit ec56478

Please sign in to comment.