Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perform a sanity check on which ways are used during routability tests #128

Merged
merged 1 commit into from
Feb 18, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions features/step_definitions/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,29 @@ def computed_route
table.hashes.each_with_index do |row,i|
got = row.dup
attempts = []
if table.headers.include? 'forw'
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*ZOOM}","#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*ZOOM}")
got['forw'] = route_status response
if got['forw'] != row['forw']
row['way'] = "w#{i}"
got['way'] = "w#{i}"
['forw','backw'].each do |direction|
if table.headers.include? direction
if direction == 'forw'
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*@zoom}")
elsif direction == 'backw'
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}")
end
got[direction] = route_status response
json = JSON.parse(response.body)
attempts << { :attempt => 'Forward', :query => @query, :response => response }
if got[direction] == 'x'
route = way_list json['route_instructions']
if route != "w#{i}"
got[direction] = "#{route}?"
end
end
if got[direction] != row[direction]
attempts << { :attempt => direction, :query => @query, :response => response }
end
end
end
if table.headers.include? 'backw'
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*ZOOM}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*ZOOM}")
got['backw'] = route_status response
if got['backw'] != row['backw']
attempts << { :attempt => 'Backward', :query => @query, :response => response }
end
end
if got != row
log_fail row,got,attempts
end
log_fail row,got,attempts if got != row
actual << got
end
end
Expand Down
2 changes: 1 addition & 1 deletion features/support/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def build_ways_from_table table
tags = row.dup
tags.delete 'forw'
tags.delete 'backw'
tags['name'] = "abcd#{ri}"
tags['name'] = "w#{ri}"
tags.reject! { |k,v| v=='' }
way << tags
osm_db << way
Expand Down