Refactor cucumber tests

This commit is contained in:
Patrick Niklaus 2015-12-08 23:00:11 +01:00
parent 7e722db3ee
commit 4ec3102df2
19 changed files with 211 additions and 341 deletions

View File

@ -3,20 +3,26 @@ When /^I request a travel time matrix I should get$/ do |table|
raise "*** Top-left cell of matrix table must be empty" unless table.headers[0]==""
nodes = []
sources = []
waypoints = []
column_headers = table.headers[1..-1]
row_headers = table.rows.map { |h| h.first }
column_headers.each do |node_name|
node = find_node_by_name(node_name)
raise "*** unknown node '#{node_name}" unless node
nodes << node
end
if column_headers!=row_headers
symmetric = Set.new(column_headers) == Set.new(row_headers)
if symmetric then
column_headers.each do |node_name|
node = find_node_by_name(node_name)
raise "*** unknown node '#{node_name}" unless node
waypoints << {:coord => node, :type => "loc"}
end
else
column_headers.each do |node_name|
node = find_node_by_name(node_name)
raise "*** unknown node '#{node_name}" unless node
waypoints << {:coord => node, :type => "dst"}
end
row_headers.each do |node_name|
node = find_node_by_name(node_name)
raise "*** unknown node '#{node_name}" unless node
sources << node
waypoints << {:coord => node, :type => "src"}
end
end
@ -27,18 +33,18 @@ When /^I request a travel time matrix I should get$/ do |table|
# compute matrix
params = @query_params
response = request_table nodes, sources, params
response = request_table waypoints, params
if response.body.empty? == false
json = JSON.parse response.body
result = json['distance_table']
json_result = JSON.parse response.body
result = json_result["distance_table"]
end
# compare actual and expected result, one row at a time
table.rows.each_with_index do |row,ri|
# fuzzy match
ok = true
0.upto(nodes.size-1) do |i|
0.upto(result[ri].size-1) do |i|
if FuzzyMatch.match result[ri][i], row[i+1]
result[ri][i] = row[i+1]
elsif row[i+1]=="" and result[ri][i]==no_route

View File

@ -9,7 +9,7 @@ When /^I request locate I should get$/ do |table|
out_node = find_node_by_name row['out']
raise "*** unknown out-node '#{row['out']}" unless out_node
response = request_locate(in_node)
response = request_locate in_node, @query_params
if response.code == "200" && response.body.empty? == false
json = JSON.parse response.body
if json['status'] == 0

View File

@ -14,7 +14,7 @@ When /^I match I should get$/ do |table|
if v=='(nil)'
params[$1]=nil
elsif v!=nil
params[$1]=v
params[$1]=[v]
end
got[k]=v
end
@ -52,182 +52,35 @@ When /^I match I should get$/ do |table|
end
sub_matchings = []
turns = ''
route = ''
duration = ''
if response.code == "200"
if table.headers.include? 'matchings'
sub_matchings = json['matchings'].compact.map { |sub| sub['matched_points']}
end
end
ok = true
encoded_result = ""
extended_target = ""
row['matchings'].split(',').each_with_index do |sub, sub_idx|
if sub_idx >= sub_matchings.length
ok = false
break
end
sub.length.times do |node_idx|
node = find_node_by_name(sub[node_idx])
out_node = sub_matchings[sub_idx][node_idx]
if FuzzyMatch.match_location out_node, node
encoded_result += sub[node_idx]
extended_target += sub[node_idx]
else
encoded_result += "? [#{out_node[0]},#{out_node[1]}]"
extended_target += "#{sub[node_idx]} [#{node.lat},#{node.lon}]"
ok = false
end
end
end
if ok
got['matchings'] = row['matchings']
got['timestamps'] = row['timestamps']
else
got['matchings'] = encoded_result
row['matchings'] = extended_target
log_fail row,got, { 'matching' => {:query => @query, :response => response} }
end
actual << got
end
end
table.diff! actual
end
When /^I match with turns I should get$/ do |table|
reprocess
actual = []
OSRMLoader.load(self,"#{prepared_file}.osrm") do
table.hashes.each_with_index do |row,ri|
if row['request']
got = {'request' => row['request'] }
response = request_url row['request']
else
params = @query_params
trace = []
timestamps = []
if row['from'] and row['to']
node = find_node_by_name(row['from'])
raise "*** unknown from-node '#{row['from']}" unless node
trace << node
node = find_node_by_name(row['to'])
raise "*** unknown to-node '#{row['to']}" unless node
trace << node
got = {'from' => row['from'], 'to' => row['to'] }
response = request_matching trace, timestamps, params
elsif row['trace']
row['trace'].each_char do |n|
node = find_node_by_name(n.strip)
raise "*** unknown waypoint node '#{n.strip}" unless node
trace << node
end
if row['timestamps']
timestamps = row['timestamps'].split(" ").compact.map { |t| t.to_i}
end
got = {'trace' => row['trace'] }
response = request_matching trace, timestamps, params
else
raise "*** no trace"
end
end
row.each_pair do |k,v|
if k =~ /param:(.*)/
if v=='(nil)'
params[$1]=nil
elsif v!=nil
params[$1]=v
end
got[k]=v
end
end
if response.body.empty? == false
json = JSON.parse response.body
end
if response.body.empty? == false
if response.code == "200"
instructions = way_list json['matchings'][0]['instructions']
bearings = bearing_list json['matchings'][0]['instructions']
compasses = compass_list json['matchings'][0]['instructions']
if table.headers.include? 'turns'
raise "*** Checking turns only support for matchings with one subtrace" unless json['matchings'].size == 1
turns = turn_list json['matchings'][0]['instructions']
modes = mode_list json['matchings'][0]['instructions']
times = time_list json['matchings'][0]['instructions']
distances = distance_list json['matchings'][0]['instructions']
summary = json['matchings'][0]['route_summary']
end
if table.headers.include? 'route'
raise "*** Checking route only support for matchings with one subtrace" unless json['matchings'].size == 1
route = way_list json['matchings'][0]['instructions']
if table.headers.include? 'duration'
raise "*** Checking duration only support for matchings with one subtrace" unless json['matchings'].size == 1
duration = json['matchings'][0]['route_summary']['total_time']
end
end
end
if table.headers.include? 'status'
got['status'] = json['status'].to_s
if table.headers.include? 'turns'
got['turns'] = turns
end
if table.headers.include? 'message'
got['message'] = json['status_message']
end
if table.headers.include? '#' # comment column
got['#'] = row['#'] # copy value so it always match
if table.headers.include? 'route'
got['route'] = route
end
if table.headers.include? 'duration'
got['duration'] = "#{summary["total_time"]}"
end
sub_matchings = []
if response.code == "200"
if table.headers.include? 'matchings'
sub_matchings = json['matchings'].compact.map { |sub| sub['matched_points']}
got['route'] = (instructions || '').strip
if table.headers.include?('distance')
if row['distance']!=''
raise "*** Distance must be specied in meters. (ex: 250m)" unless row['distance'] =~ /\d+m/
end
got['distance'] = instructions ? "#{json['route_summary']['total_distance'].to_s}m" : ''
end
if table.headers.include?('time')
raise "*** Time must be specied in seconds. (ex: 60s)" unless row['time'] =~ /\d+s/
got['time'] = instructions ? "#{json['route_summary']['total_time'].to_s}s" : ''
end
if table.headers.include?('speed')
if row['speed'] != '' && instructions
raise "*** Speed must be specied in km/h. (ex: 50 km/h)" unless row['speed'] =~ /\d+ km\/h/
time = json['route_summary']['total_time']
distance = json['route_summary']['total_distance']
speed = time>0 ? (3.6*distance/time).to_i : nil
got['speed'] = "#{speed} km/h"
else
got['speed'] = ''
end
end
if table.headers.include? 'bearing'
got['bearing'] = instructions ? bearings : ''
end
if table.headers.include? 'compass'
got['compass'] = instructions ? compasses : ''
end
if table.headers.include? 'turns'
got['turns'] = instructions ? turns : ''
end
if table.headers.include? 'modes'
got['modes'] = instructions ? modes : ''
end
if table.headers.include? 'times'
got['times'] = instructions ? times : ''
end
if table.headers.include? 'distances'
got['distances'] = instructions ? distances : ''
end
end
if table.headers.include? 'start'
got['start'] = instructions ? json['route_summary']['start_point'] : nil
end
if table.headers.include? 'end'
got['end'] = instructions ? json['route_summary']['end_point'] : nil
end
if table.headers.include? 'geometry'
got['geometry'] = json['route_geometry']
end
got['duration'] = duration.to_s
end
ok = true
@ -252,8 +105,12 @@ When /^I match with turns I should get$/ do |table|
end
end
if ok
got['matchings'] = row['matchings']
got['timestamps'] = row['timestamps']
if table.headers.include? 'matchings'
got['matchings'] = row['matchings']
end
if table.headers.include? 'timestamps'
got['timestamps'] = row['timestamps']
end
else
got['matchings'] = encoded_result
row['matchings'] = extended_target

View File

@ -9,7 +9,7 @@ When /^I request nearest I should get$/ do |table|
out_node = find_node_by_name row['out']
raise "*** unknown out-node '#{row['out']}" unless out_node
response = request_nearest(in_node)
response = request_nearest in_node, @query_params
if response.code == "200" && response.body.empty? == false
json = JSON.parse response.body
if json['status'] == 0

View File

@ -53,5 +53,5 @@ Then /^stdout should contain (\d+) lines?$/ do |lines|
end
Given (/^the query options$/) do |table|
@query_params = table.rows_hash
table.rows_hash.each { |k,v| @query_params << [k, v] }
end

View File

@ -1,7 +1,7 @@
When /^I request \/(.*)$/ do |path|
reprocess
OSRMLoader.load(self,"#{prepared_file}.osrm") do
@response = request_path path
@response = request_path path, []
end
end

View File

@ -4,7 +4,7 @@ def test_routability_row i
a = Location.new @origin[0]+(1+WAY_SPACING*i)*@zoom, @origin[1]
b = Location.new @origin[0]+(3+WAY_SPACING*i)*@zoom, @origin[1]
r = {}
r[:response] = request_route (direction=='forw' ? [a,b] : [b,a]), @query_params
r[:response] = request_route (direction=='forw' ? [a,b] : [b,a]), [], @query_params
r[:query] = @query
r[:json] = JSON.parse(r[:response].body)

View File

@ -7,19 +7,26 @@ When /^I route I should get$/ do |table|
got = {'request' => row['request'] }
response = request_url row['request']
else
params = @query_params
default_params = @query_params
user_params = []
got = {}
row.each_pair do |k,v|
if k =~ /param:(.*)/
if v=='(nil)'
params[$1]=nil
user_params << [$1, nil]
elsif v!=nil
params[$1]=v
user_params << [$1, v]
end
got[k]=v
end
end
params = overwrite_params default_params, user_params
waypoints = []
bearings = []
if row['bearings']
got['bearings'] = row['bearings']
bearings = row['bearings'].split(' ').compact
end
if row['from'] and row['to']
node = find_node_by_name(row['from'])
raise "*** unknown from-node '#{row['from']}" unless node
@ -30,7 +37,7 @@ When /^I route I should get$/ do |table|
waypoints << node
got = got.merge({'from' => row['from'], 'to' => row['to'] })
response = request_route waypoints, params
response = request_route waypoints, bearings, params
elsif row['waypoints']
row['waypoints'].split(',').each do |n|
node = find_node_by_name(n.strip)
@ -38,7 +45,7 @@ When /^I route I should get$/ do |table|
waypoints << node
end
got = got.merge({'waypoints' => row['waypoints'] })
response = request_route waypoints, params
response = request_route waypoints, bearings, params
else
raise "*** no waypoints"
end

View File

@ -38,7 +38,7 @@ When /^I plan a trip I should get$/ do |table|
if v=='(nil)'
params[$1]=nil
elsif v!=nil
params[$1]=v
params[$1]=[v]
end
got[k]=v
end

View File

@ -15,7 +15,7 @@ Before do |scenario|
end
@load_method = DEFAULT_LOAD_METHOD
@query_params = {}
@query_params = []
@scenario_time = Time.now.strftime("%Y-%m-%dT%H:%m:%SZ")
reset_data
@has_logged_preprocess_info = false

View File

@ -1,29 +1,32 @@
require 'net/http'
def generate_request_url path
if @http_method.eql? "POST"
pos = path.index('?') - 1
service = path[0..pos]
uri = URI.parse "#{HOST}/#{service}"
else
uri = URI.parse "#{HOST}/#{path}"
# Converts an array [["param","val1"], ["param","val2"]] into ?param=val1&param=val2
def params_to_url params
kv_pairs = params.map { |kv| kv[0].to_s + "=" + kv[1].to_s }
url = kv_pairs.size > 0 ? ("?" + kv_pairs.join("&")) : ""
return url
end
# Converts an array [["param","val1"], ["param","val2"]] into ["param"=>["val1", "val2"]]
def params_to_map params
result = {}
params.each do |pair|
if not result.has_key? pair[0]
result[pair[0]] = []
end
result[pair[0]] << [pair[1]]
end
end
def send_request uri, waypoints=[], options={}, timestamps=[]
@query = uri.to_s
def send_request base_uri, parameters
Timeout.timeout(OSRM_TIMEOUT) do
if @http_method.eql? "POST"
datas = {}
if waypoints.length > 0
datas[:loc] = waypoints.compact.map { |w| "#{w.lat},#{w.lon}" }
end
if timestamps.length > 0
datas[:t] = timestamps.compact.map { |t| "#{t}" }
end
datas.merge! options
response = Net::HTTP.post_form uri, datas
uri = URI.parse base_uri
@query = uri.to_s
response = Net::HTTP.post_form uri, (params_to_map parameters)
else
uri = URI.parse base_uri+(params_to_url parameters)
@query = uri.to_s
response = Net::HTTP.get_response uri
end
end

View File

@ -1,12 +0,0 @@
require 'net/http'
def request_locate_url path, node
@query = path
uri = generate_request_url path
response = send_request uri, [node]
end
def request_locate node
request_locate_url "locate?loc=#{node.lat},#{node.lon}", node
end

View File

@ -1,20 +0,0 @@
require 'net/http'
HOST = "http://127.0.0.1:#{OSRM_PORT}"
def request_matching trace=[], timestamps=[], options={}
defaults = { 'output' => 'json', 'instructions' => 'true' }
locs = trace.compact.map { |w| "loc=#{w.lat},#{w.lon}" }
ts = timestamps.compact.map { |t| "t=#{t}" }
if ts.length > 0
trace_params = locs.zip(ts).map { |a| a.join('&')}
else
trace_params = locs
end
params = (trace_params + defaults.merge(options).to_param).join('&')
params = nil if params==""
uri = generate_request_url ("match" + '?' + params)
response = send_request uri, trace, options, timestamps
end

View File

@ -1,12 +0,0 @@
require 'net/http'
def request_nearest_url path, node
@query = path
uri = generate_request_url path
response = send_request uri, [node]
end
def request_nearest node
request_nearest_url "nearest?loc=#{node.lat},#{node.lon}", node
end

View File

@ -3,25 +3,10 @@ require 'net/http'
HOST = "http://127.0.0.1:#{OSRM_PORT}"
DESTINATION_REACHED = 15 #OSRM instruction code
class Hash
def to_param(namespace = nil)
collect do |key, value|
"#{key}=#{value}"
end.sort
end
end
def request_path path, waypoints=[], options={}
locs = waypoints.compact.map { |w| "loc=#{w.lat},#{w.lon}" }
params = (locs + options.to_param).join('&')
params = nil if params==""
if params == nil
uri = generate_request_url (path)
else
uri = generate_request_url (path + '?' + params)
end
response = send_request uri, waypoints, options
def request_path service, params
uri = "#{HOST}/" + service
response = send_request uri, params
return response
end
def request_url path
@ -36,18 +21,87 @@ rescue Timeout::Error
raise "*** osrm-routed did not respond."
end
def request_route waypoints, params={}
defaults = { 'output' => 'json', 'instructions' => true, 'alt' => false }
request_path "viaroute", waypoints, defaults.merge(params)
# Overwriters the default values in defaults.
# e.g. [[a, 1], [b, 2]], [[a, 5], [d, 10]] => [[a, 5], [b, 2], [d, 10]]
def overwrite_params defaults, other
merged = []
defaults.each do |k,v|
idx = other.index { |p| p[0] == k }
if idx == nil then
merged << [k, v]
else
merged << [k, other[idx][1]]
end
end
other.each do |k,v|
if merged.index { |pair| pair[0] == k} == nil then
merged << [k, v]
end
end
return merged
end
def request_table waypoints, sources, params={}
defaults = { 'output' => 'json' }
options = defaults.merge(params)
locs = (sources.size > 0) ? (waypoints.compact.map { |w| "dst=#{w.lat},#{w.lon}" } + sources.compact.map { |w| "src=#{w.lat},#{w.lon}" }) : waypoints.compact.map { |w| "loc=#{w.lat},#{w.lon}" }
params = (locs + options.to_param).join('&')
uri = generate_request_url ("table" + '?' + params)
response = send_request uri, waypoints, options, sources
def request_route waypoints, bearings, user_params
raise "*** number of bearings does not equal the number of waypoints" unless bearings.size == 0 || bearings.size == waypoints.size
defaults = [['output','json'], ['instructions',true], ['alt',false]]
params = overwrite_params defaults, user_params
encoded_waypoint = waypoints.map{ |w| ["loc","#{w.lat},#{w.lon}"] }
if bearings.size > 0
encoded_bearings = bearings.map { |b| ["b", b.to_s]}
parasm = params.concat encoded_waypoint.zip(encoded_bearings).flatten! 1
else
params = params.concat encoded_waypoint
end
return request_path "viaroute", params
end
def request_locate node, user_params
defaults = [['output', 'json']]
params = overwrite_params defaults, user_params
params << ["loc", "#{node.lat},#{node.lon}"]
return request_path "locate", params
end
def request_nearest node, user_params
defaults = [['output', 'json']]
params = overwrite_params defaults, user_params
params << ["loc", "#{node.lat},#{node.lon}"]
return request_path "nearest", params
end
def request_table waypoints, user_params
defaults = [['output', 'json']]
params = overwrite_params defaults, user_params
params = params.concat waypoints.map{ |w| [w[:type],"#{w[:coord].lat},#{w[:coord].lon}"] }
return request_path "table", params
end
def request_trip waypoints, user_params
defaults = [['output', 'json']]
params = overwrite_params defaults, user_params
params = params.concat waypoints.map{ |w| ["loc","#{w.lat},#{w.lon}"] }
return request_path "trip", params
end
def request_matching waypoints, timestamps, user_params
defaults = [['output', 'json']]
params = overwrite_params defaults, user_params
encoded_waypoint = waypoints.map{ |w| ["loc","#{w.lat},#{w.lon}"] }
if timestamps.size > 0
encoded_timestamps = timestamps.map { |t| ["t", t.to_s]}
parasm = params.concat encoded_waypoint.zip(encoded_timestamps).flatten! 1
else
params = params.concat encoded_waypoint
end
return request_path "match", params
end
def got_route? response
@ -57,14 +111,14 @@ def got_route? response
return way_list( json['route_instructions']).empty? == false
end
end
false
return false
end
def route_status response
if response.code == "200" && !response.body.empty?
json = JSON.parse response.body
if json['status'] == 0
if way_list( json['route_instructions']).empty?
if way_list(json['route_instructions']).empty?
return 'Empty route'
else
return 'x'

View File

@ -1,14 +0,0 @@
require 'net/http'
HOST = "http://127.0.0.1:#{OSRM_PORT}"
def request_trip waypoints=[], params={}
defaults = { 'output' => 'json' }
locs = waypoints.compact.map { |w| "loc=#{w.lat},#{w.lon}" }
params = (locs + defaults.merge(params).to_param).join('&')
params = nil if params==""
uri = generate_request_url ("trip" + '?' + params)
response = send_request uri, waypoints, params
end

View File

@ -14,12 +14,12 @@ Feature: Bearing parameter
| ad |
When I route I should get
| from | to | param:b | route | bearing |
| b | c | 90&b=90 | ad | 90 |
| b | c | 180&b=90 | | |
| b | c | 80&b=100 | ad | 90 |
| b | c | 79&b=100 | | |
| b | c | 79,11&b=100 | ad | 90 |
| from | to | bearings | route | bearing |
| b | c | 90 90 | ad | 90 |
| b | c | 180 90 | | |
| b | c | 80 100 | ad | 90 |
| b | c | 79 100 | | |
| b | c | 79,11 100 | ad | 90 |
Scenario: Testbot - Intial bearing in simple case
Given the node map
@ -33,13 +33,13 @@ Feature: Bearing parameter
| bc |
When I route I should get
| from | to | param:b | route | bearing |
| 0 | c | 0&b=0 | | |
| 0 | c | 45&b=45 | bc | 45 ~3% |
| 0 | c | 85&b=85 | | |
| 0 | c | 95&b=95 | | |
| 0 | c | 135&b=135 | ac | 135 ~1% |
| 0 | c | 180&b=180 | | |
| from | to | bearings | route | bearing |
| 0 | c | 0 0 | | |
| 0 | c | 45 45 | bc | 45 ~3% |
| 0 | c | 85 85 | | |
| 0 | c | 95 95 | | |
| 0 | c | 135 135 | ac | 135 ~1% |
| 0 | c | 180 180 | | |
Scenario: Testbot - Initial bearing on split way
Given the node map
@ -54,21 +54,21 @@ Feature: Bearing parameter
| da | yes |
When I route I should get
| from | to | param:b | route | bearing |
| 0 | b | 10&b=10 | bc | 0 |
| 0 | b | 90&b=90 | ab | 90 |
| from | to | bearings | route | bearing |
| 0 | b | 10 10 | bc | 0 |
| 0 | b | 90 90 | ab | 90 |
# The returned bearing is wrong here, it's based on the snapped
# coordinates, not the acutal edge bearing. This should be
# fixed one day, but it's only a problem when we snap too vias
# to the same point - DP
#| 0 | b | 170&b=170 | da | 180 |
#| 0 | b | 189&b=189 | da | 180 |
| 0 | 1 | 90&b=270 | ab,bc,cd | 90,0,270 |
| 1 | d | 10&b=10 | bc | 0 |
| 1 | d | 90&b=90 | ab,bc,cd,da | 90,0,270,180 |
| 1 | 0 | 189&b=189 | da | 180 |
| 1 | d | 270&b=270 | cd | 270 |
| 1 | d | 349&b=349 | | |
#| 0 | b | 170 170 | da | 180 |
#| 0 | b | 189 189 | da | 180 |
| 0 | 1 | 90 270 | ab,bc,cd | 90,0,270 |
| 1 | d | 10 10 | bc | 0 |
| 1 | d | 90 90 | ab,bc,cd,da | 90,0,270,180 |
| 1 | 0 | 189 189 | da | 180 |
| 1 | d | 270 270 | cd | 270 |
| 1 | d | 349 349 | | |
Scenario: Testbot - Initial bearing in all direction
Given the node map
@ -100,12 +100,12 @@ Feature: Bearing parameter
| ha | yes |
When I route I should get
| from | to | param:b | route | bearing |
| 0 | q | 0&b=90 | ia,ab,bc,cd,de,ef,fg,gh,ha | 0,90,180,180,270,270,0,0,90 |
| 0 | a | 45&b=90 | jb,bc,cd,de,ef,fg,gh,ha | 45,180,180,270,270,0,0,90 |
| 0 | q | 90&b=90 | kc,cd,de,ef,fg,gh,ha | 90,180,270,270,0,0,90 |
| 0 | a | 135&b=90 | ld,de,ef,fg,gh,ha | 135,270,270,0,0,90 |
| 0 | a | 180&b=90 | me,ef,fg,gh,ha | 180,270,0,0,90 |
| 0 | a | 225&b=90 | nf,fg,gh,ha | 225,0,0,90 |
| 0 | a | 270&b=90 | og,gh,ha | 270,0,90 |
| 0 | a | 315&b=90 | ph,ha | 315,90 |
| from | to | bearings | route | bearing |
| 0 | q | 0 90 | ia,ab,bc,cd,de,ef,fg,gh,ha | 0,90,180,180,270,270,0,0,90 |
| 0 | a | 45 90 | jb,bc,cd,de,ef,fg,gh,ha | 45,180,180,270,270,0,0,90 |
| 0 | q | 90 90 | kc,cd,de,ef,fg,gh,ha | 90,180,270,270,0,0,90 |
| 0 | a | 135 90 | ld,de,ef,fg,gh,ha | 135,270,270,0,0,90 |
| 0 | a | 180 90 | me,ef,fg,gh,ha | 180,270,0,0,90 |
| 0 | a | 225 90 | nf,fg,gh,ha | 225,0,0,90 |
| 0 | a | 270 90 | og,gh,ha | 270,0,90 |
| 0 | a | 315 90 | ph,ha | 315,90 |

View File

@ -101,7 +101,7 @@ Feature: Basic Distance Matrix
| d | 200 | 300 | 0 | 300 |
| e | 300 | 400 | 100 | 0 |
Scenario: Testbot - Travel time matrix and mapped coordinates with only one source
Scenario: Testbot - Travel time matrix and with only one source
Given the node map
| a | b | c |
| d | e | f |
@ -114,9 +114,6 @@ Feature: Basic Distance Matrix
| be |
| cf |
And the query options
| mapped_points | true |
When I request a travel time matrix I should get
| | a | b | e | f |
| a | 0 | 100 | 200 | 300 |

View File

@ -5,6 +5,8 @@ Feature: Turn directions/codes
Given the profile "testbot"
Scenario: Turn directions
Given the query options
| instructions | true |
Given the node map
| o | p | a | b | c |
| n | | | | d |
@ -31,7 +33,7 @@ Feature: Turn directions/codes
| xo |
| xp |
When I match with turns I should get
When I match I should get
| trace | route | turns | matchings |
| im | xi,xm | head,left,destination | im |
| io | xi,xo | head,slight_left,destination | io |
@ -82,6 +84,8 @@ Feature: Turn directions/codes
| gc | xg,xc | head,right,destination | gc |
Scenario: Turn directions
Given the query options
| instructions | true |
Given the node map
| o | p | a | b | c |
| n | | | | d |
@ -108,7 +112,7 @@ Feature: Turn directions/codes
| xo |
| xp |
When I match with turns I should get
When I match I should get
| trace | route | turns | matchings | duration |
| im | xi,xm | head,left,destination | im | 80 |
| io | xi,xo | head,slight_left,destination | io | 88 |