use osrm-database during testing

This commit is contained in:
Emil Tin
2014-01-24 21:14:38 +01:00
committed by Emil Tin
parent bc6466cc36
commit 7ba8e51fa9
12 changed files with 192 additions and 55 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
When /^I request locate I should get$/ do |table|
reprocess
actual = []
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
OSRMLoader.load("#{@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 -1
View File
@@ -1,7 +1,7 @@
When /^I request nearest I should get$/ do |table|
reprocess
actual = []
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
OSRMLoader.load("#{@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
+5 -1
View File
@@ -1,6 +1,6 @@
When(/^I run "osrm\-routed\s?(.*?)"$/) do |options|
begin
Timeout.timeout(1) { run_bin 'osrm-routed', options }
Timeout.timeout(SHUTDOWN_TIMEOUT) { run_bin 'osrm-routed', options }
rescue Timeout::Error
raise "*** osrm-routed didn't quit. Maybe the --trial option wasn't used?"
end
@@ -14,6 +14,10 @@ When(/^I run "osrm\-prepare\s?(.*?)"$/) do |options|
run_bin 'osrm-prepare', options
end
When(/^I run "osrm\-datastore\s?(.*?)"$/) do |options|
run_bin 'osrm-datastore', options
end
Then /^it should exit with code (\d+)$/ do |code|
expect(@exit_code).to eq( code.to_i )
end
+2 -2
View File
@@ -1,6 +1,6 @@
When /^I request \/(.*)$/ do |path|
reprocess
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
OSRMLoader.load("#{@osm_file}.osrm") do
@response = request_path path
end
end
@@ -43,4 +43,4 @@ Then /^"([^"]*)" should return code (\d+)$/ do |binary, code|
expect(@process_error.is_a?(OSRMError)).to eq(true)
expect(@process_error.process).to eq(binary)
expect(@process_error.code.to_i).to eq(code.to_i)
end
end
+1 -1
View File
@@ -44,7 +44,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
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
OSRMLoader.load("#{@osm_file}.osrm") do
table.hashes.each_with_index do |row,i|
output_row = row.dup
attempts = []
+1 -1
View File
@@ -1,7 +1,7 @@
When /^I route I should get$/ do |table|
reprocess
actual = []
OSRMBackgroundLauncher.new("#{@osm_file}.osrm") do
OSRMLoader.load("#{@osm_file}.osrm") do
table.hashes.each_with_index do |row,ri|
if row['request']
got = {'request' => row['request'] }