update cucumber test to work with lua profiles
This commit is contained in:
@@ -78,20 +78,6 @@ Feature: Oneway streets
|
||||
| motorway_link | | -1 | | x |
|
||||
| trunk_link | | -1 | | x |
|
||||
| primary | roundabout | -1 | | x |
|
||||
|
||||
Scenario: Disabling oneways in speedprofile
|
||||
Given the speedprofile "car"
|
||||
And the speedprofile settings
|
||||
| obeyOneways | no |
|
||||
Then routability should be
|
||||
| highway | junction | oneway | forw | backw |
|
||||
| primary | | yes | x | x |
|
||||
| primary | | true | x | x |
|
||||
| primary | | 1 | x | x |
|
||||
| primary | | -1 | x | x |
|
||||
| motorway_link | | | x | x |
|
||||
| trunk_link | | | x | x |
|
||||
| primary | roundabout | | x | x |
|
||||
|
||||
@bicycle
|
||||
Scenario: Oneway:bicycle should override normal oneways tags
|
||||
|
||||
@@ -3,8 +3,6 @@ Feature: Penalties
|
||||
|
||||
Background:
|
||||
Given the speedprofile "bicycle"
|
||||
And the speedprofile settings
|
||||
| trafficSignalPenalty | 20 |
|
||||
|
||||
Scenario: Passing a traffic signal should incur a delay
|
||||
Given the node map
|
||||
|
||||
@@ -2,12 +2,6 @@ Given /^the speedprofile "([^"]*)"$/ do |profile|
|
||||
read_speedprofile profile
|
||||
end
|
||||
|
||||
Given /^the speedprofile settings$/ do |table|
|
||||
table.raw.each do |row|
|
||||
speedprofile[ row[0] ] = row[1]
|
||||
end
|
||||
end
|
||||
|
||||
Given /^a grid size of (\d+) meters$/ do |meters|
|
||||
set_grid_size meters
|
||||
end
|
||||
|
||||
@@ -252,7 +252,7 @@ When /^I route I should get$/ do |table|
|
||||
ok = false
|
||||
end
|
||||
else
|
||||
ok = row[key] == got[key].to_f
|
||||
ok = row[key] == got[key]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,25 +3,16 @@ def speedprofile
|
||||
end
|
||||
|
||||
def reset_speedprofile
|
||||
@speedprofile = {}
|
||||
@speedprofile = nil
|
||||
read_speedprofile DEFAULT_SPEEDPROFILE
|
||||
end
|
||||
|
||||
def read_speedprofile profile
|
||||
@speedprofile = {}
|
||||
@speedprofile_str = nil
|
||||
s = File.read "test/speedprofiles/#{profile}.ini"
|
||||
s.scan /(.*)=(.*)/ do |option|
|
||||
@speedprofile[option[0].strip] = option[1].strip
|
||||
end
|
||||
end
|
||||
|
||||
def speedprofile_str
|
||||
@speedprofile_str ||= "[Scenario: #{@scenario_title}]\n" + @speedprofile.map { |k,v| " #{k} = #{v}" }.join("\n")
|
||||
@speedprofile = profile
|
||||
end
|
||||
|
||||
def write_speedprofile
|
||||
File.open( 'speedprofile.ini', 'w') {|f| f.write( speedprofile_str ) }
|
||||
FileUtils.copy_file "profiles/#{@speedprofile}.lua", "profile.lua"
|
||||
end
|
||||
|
||||
def write_server_ini
|
||||
|
||||
@@ -14,7 +14,7 @@ DEFAULT_SPEEDPROFILE = 'bicycle'
|
||||
WAY_SPACING = 100
|
||||
DEFAULT_GRID_SIZE = 100 #meters
|
||||
|
||||
ORIGIN = [1,1]
|
||||
ORIGIN = [12,55]
|
||||
|
||||
def set_grid_size meters
|
||||
@zoom = 0.001*(meters.to_f/111.21)
|
||||
|
||||
@@ -12,11 +12,7 @@ def hash_of_file path
|
||||
end
|
||||
|
||||
def speedprofile_hash
|
||||
@speedprofile_hash ||= Digest::SHA1.hexdigest speedprofile_str
|
||||
end
|
||||
|
||||
def osm_hash
|
||||
@osm_hash ||= Digest::SHA1.hexdigest osm_str
|
||||
@speedprofile_hash ||= hash_of_file "profile.lua"
|
||||
end
|
||||
|
||||
def osm_hash
|
||||
|
||||
@@ -13,12 +13,13 @@ def log_scenario_fail_info
|
||||
log "========================================="
|
||||
log "Failed scenario: #{@scenario_title}"
|
||||
log "Time: #{@scenario_time}"
|
||||
log "Fingerprint: #{@fingerprint}"
|
||||
log "Profile: #{@speedprofile}"
|
||||
log
|
||||
log '```xml' #so output can be posted directly to github comment fields
|
||||
log osm_str.strip
|
||||
log '```'
|
||||
log
|
||||
log speedprofile_str
|
||||
log
|
||||
@has_logged_scenario_info = true
|
||||
end
|
||||
@@ -27,7 +28,7 @@ def log_fail expected,actual,failed
|
||||
log_scenario_fail_info
|
||||
log "== "
|
||||
log "Expected: #{expected}"
|
||||
log "Got: #{actual}"
|
||||
log "Got: #{actual}"
|
||||
log
|
||||
failed.each do |fail|
|
||||
log "Attempt: #{fail[:attempt]}"
|
||||
@@ -49,8 +50,8 @@ def log_preprocess_info
|
||||
log osm_str, :preprocess
|
||||
log '```', :preprocess
|
||||
log '', :preprocess
|
||||
log "== Speed profile:", :preprocess
|
||||
log speedprofile_str.strip, :preprocess
|
||||
log "== Profile:", :preprocess
|
||||
log @speedprofile, :preprocess
|
||||
log '', :preprocess
|
||||
@has_logged_preprocess_info = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user