Expose component size variable as command-line option (this allows testing of big/small components in cucumber tests).

Add ability to pass extra parameters to  during tests.
Limit distance table search so that it doesn't return any big components if they're beyond max_distance.
This commit is contained in:
Daniel Patterson
2015-12-01 17:46:29 -08:00
committed by Patrick Niklaus
parent f3f153cb38
commit 4ddbd2efb6
7 changed files with 43 additions and 3 deletions
+4
View File
@@ -6,6 +6,10 @@ Given(/^the import format "(.*?)"$/) do |format|
set_input_format format
end
Given /^the extract extra arguments "(.*?)"$/ do |args|
set_extract_args args
end
Given /^a grid size of (\d+) meters$/ do |meters|
set_grid_size meters
end
+4
View File
@@ -10,3 +10,7 @@ end
def set_profile profile
@profile = profile
end
def set_extract_args args
@extract_args = args
end
+1 -1
View File
@@ -274,7 +274,7 @@ def extract_data
Dir.chdir TEST_FOLDER do
log_preprocess_info
log "== Extracting #{osm_file}.osm...", :preprocess
unless system "#{BIN_PATH}/osrm-extract #{osm_file}.osm#{'.pbf' if pbf?} --profile #{PROFILES_PATH}/#{@profile}.lua >>#{PREPROCESS_LOG_FILE} 2>&1"
unless system "#{BIN_PATH}/osrm-extract #{osm_file}.osm#{'.pbf' if pbf?} #{@extract_args} --profile #{PROFILES_PATH}/#{@profile}.lua >>#{PREPROCESS_LOG_FILE} 2>&1"
log "*** Exited with code #{$?.exitstatus}.", :preprocess
raise ExtractError.new $?.exitstatus, "osrm-extract exited with code #{$?.exitstatus}."
end
+27
View File
@@ -135,3 +135,30 @@ Feature: Basic Distance Matrix
| | b | e | f |
| a | 100 | 200 | 300 |
| b | 0 | 100 | 200 |
# There is a 1100m limit when searching for nearest neighbours
# so we set the grid size to something that makes it easy to
# put nodes inside/outside that limit
Scenario: Testbog - Check snapping on on small components
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
Given the node map
| a | b | | | m | | x |
| d | e | | | n | | y |
And the ways
| nodes |
| ab |
| be |
| ed |
| da |
| xy |
When I request a travel time matrix I should get
| | a | b | x | y | m | n |
| a | 0 | 300 | | | 300 | 600 |
| b | 300 | 0 | | | 0 | 300 |
| x | | | 0 | 300 | | |
| y | | | 300 | 0 | | |
| m | 300 | 0 | | | 0 | 300 |
| n | 600 | 300 | | | 300 | 0 |