perform a sanity check on which ways are used during routability tests
This commit is contained in:
parent
b897b5d0e2
commit
801490b9fc
@ -157,24 +157,29 @@ Then /^routability should be$/ do |table|
|
|||||||
table.hashes.each_with_index do |row,i|
|
table.hashes.each_with_index do |row,i|
|
||||||
got = row.dup
|
got = row.dup
|
||||||
attempts = []
|
attempts = []
|
||||||
if table.headers.include? 'forw'
|
row['way'] = "w#{i}"
|
||||||
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*ZOOM}","#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*ZOOM}")
|
got['way'] = "w#{i}"
|
||||||
got['forw'] = route_status response
|
['forw','backw'].each do |direction|
|
||||||
if got['forw'] != row['forw']
|
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)
|
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
|
||||||
end
|
end
|
||||||
if table.headers.include? 'backw'
|
if got[direction] != row[direction]
|
||||||
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*ZOOM}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*ZOOM}")
|
attempts << { :attempt => direction, :query => @query, :response => response }
|
||||||
got['backw'] = route_status response
|
|
||||||
if got['backw'] != row['backw']
|
|
||||||
attempts << { :attempt => 'Backward', :query => @query, :response => response }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if got != row
|
|
||||||
log_fail row,got,attempts
|
|
||||||
end
|
end
|
||||||
|
log_fail row,got,attempts if got != row
|
||||||
actual << got
|
actual << got
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -56,7 +56,7 @@ def build_ways_from_table table
|
|||||||
tags = row.dup
|
tags = row.dup
|
||||||
tags.delete 'forw'
|
tags.delete 'forw'
|
||||||
tags.delete 'backw'
|
tags.delete 'backw'
|
||||||
tags['name'] = "abcd#{ri}"
|
tags['name'] = "w#{ri}"
|
||||||
tags.reject! { |k,v| v=='' }
|
tags.reject! { |k,v| v=='' }
|
||||||
way << tags
|
way << tags
|
||||||
osm_db << way
|
osm_db << way
|
||||||
|
Loading…
Reference in New Issue
Block a user