cuke: test osrm-routed options
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
When /^I request locate I should get$/ do |table|
|
||||
reprocess
|
||||
actual = []
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,ri|
|
||||
in_node = find_node_by_name row['in']
|
||||
raise "*** unknown in-node '#{row['in']}" unless in_node
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
When /^I request nearest I should get$/ do |table|
|
||||
reprocess
|
||||
actual = []
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,ri|
|
||||
in_node = find_node_by_name row['in']
|
||||
raise "*** unknown in-node '#{row['in']}" unless in_node
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
When(/^I run "osrm\-routed\s?(.*?)"$/) do |options|
|
||||
Dir.chdir TEST_FOLDER do
|
||||
begin
|
||||
Timeout.timeout(1) do
|
||||
@stdout = `#{BIN_PATH}/osrm-routed #{options} 2>error.log`
|
||||
@stderr = File.read 'error.log'
|
||||
@exit_code = $?.exitstatus
|
||||
end
|
||||
rescue
|
||||
# TODO would be easy to handle there was an option to make osrm exit right after completing initialization
|
||||
@stdout = nil
|
||||
@stderr = nil
|
||||
@exit_code = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Then /^it should exit with code (\d+)$/ do |code|
|
||||
@exit_code.should == code.to_i
|
||||
end
|
||||
|
||||
Then /^stdout should contain "(.*?)"$/ do |str|
|
||||
@stdout.include?(str).should == true
|
||||
end
|
||||
|
||||
Then /^stderr should contain "(.*?)"$/ do |str|
|
||||
@stderr.include?(str).should == true
|
||||
end
|
||||
|
||||
Then /^stdout should be empty$/ do
|
||||
@stdout.should == ""
|
||||
end
|
||||
|
||||
Then /^stderr should be empty$/ do
|
||||
@stderr.should == ""
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
When /^I request \/(.*)$/ do |path|
|
||||
reprocess
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
|
||||
@response = request_path path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ Then /^routability should be$/ do |table|
|
||||
if table.headers&["forw","backw","bothw"] == []
|
||||
raise "*** routability tabel must contain either 'forw', 'backw' or 'bothw' column"
|
||||
end
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,i|
|
||||
got = row.dup
|
||||
attempts = []
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
When /^I route I should get$/ do |table|
|
||||
reprocess
|
||||
actual = []
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,ri|
|
||||
waypoints = []
|
||||
if row['from'] and row['to']
|
||||
|
||||
Reference in New Issue
Block a user