cuke: use .osm by default, add tests for .pbf
This commit is contained in:
parent
72f41c5b4f
commit
220e7748a9
@ -2,6 +2,10 @@ Given /^the profile "([^"]*)"$/ do |profile|
|
||||
set_profile profile
|
||||
end
|
||||
|
||||
Given(/^the import format "(.*?)"$/) do |format|
|
||||
set_input_format format
|
||||
end
|
||||
|
||||
Given /^a grid size of (\d+) meters$/ do |meters|
|
||||
set_grid_size meters
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ WAY_SPACING = 100
|
||||
DEFAULT_GRID_SIZE = 100 #meters
|
||||
PROFILES_PATH = '../profiles'
|
||||
BIN_PATH = '../build'
|
||||
|
||||
DEFAULT_INPUT_FORMAT = 'osm'
|
||||
DEFAULT_ORIGIN = [1,1]
|
||||
|
||||
class Location
|
||||
@ -25,6 +25,15 @@ class Location
|
||||
end
|
||||
end
|
||||
|
||||
def set_input_format format
|
||||
raise '*** Input format must be eiter "osm" or "pbf"' unless ['pbf','osm'].include? format.to_s
|
||||
@input_format = format.to_s
|
||||
end
|
||||
|
||||
def input_format
|
||||
@input_format || DEFAULT_INPUT_FORMAT
|
||||
end
|
||||
|
||||
def sanitized_scenario_title
|
||||
@sanitized_scenario_title ||= @scenario_title.gsub /[^0-9A-Za-z.\-]/, '_'
|
||||
end
|
||||
@ -244,8 +253,8 @@ def write_timestamp
|
||||
end
|
||||
|
||||
def reprocess
|
||||
use_pbf = true
|
||||
Dir.chdir TEST_FOLDER do
|
||||
use_pbf = (input_format=='pbf')
|
||||
write_osm
|
||||
write_timestamp
|
||||
convert_osm_to_pbf if use_pbf
|
||||
|
156
features/testbot/protobuffer.feature
Normal file
156
features/testbot/protobuffer.feature
Normal file
@ -0,0 +1,156 @@
|
||||
@routing @pbf
|
||||
Feature: Importing protobuffer (.pbf) format
|
||||
# Test normally read .osm, which is faster than .pbf files,
|
||||
# since we don't need to use osmosis to first convert to .pbf
|
||||
# The scenarios in this file test the ability to import .pbf files,
|
||||
# including nodes, way, restictions, and a various special situations.
|
||||
|
||||
Background:
|
||||
Given the profile "testbot"
|
||||
And the import format "pbf"
|
||||
|
||||
Scenario: Testbot - Protobuffer import, nodes and ways
|
||||
Given the node map
|
||||
| | | | d |
|
||||
| a | b | c | |
|
||||
| | | | e |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | oneway |
|
||||
| abc | primary | |
|
||||
| cd | primary | yes |
|
||||
| ce | river | |
|
||||
| de | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| d | c | de,ce |
|
||||
| e | d | de |
|
||||
|
||||
|
||||
Scenario: Testbot - Protobuffer import, turn restiction relations
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| nj | -1 |
|
||||
| wj | -1 |
|
||||
| ej | -1 |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | wj | j | no_left_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | |
|
||||
| s | n | sj,nj |
|
||||
| s | e | sj,ej |
|
||||
|
||||
|
||||
Scenario: Testbot - Protobuffer import, distances at longitude 45
|
||||
Given the node locations
|
||||
| node | lat | lon |
|
||||
| a | 80 | 45 |
|
||||
| b | 0 | 45 |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | distance |
|
||||
| a | b | ab | 8905559m ~0.1% |
|
||||
|
||||
Scenario: Testbot - Protobuffer import, distances at longitude 80
|
||||
Given the node locations
|
||||
| node | lat | lon |
|
||||
| a | 80 | 80 |
|
||||
| b | 0 | 80 |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | distance |
|
||||
| a | b | ab | 8905559m ~0.1% |
|
||||
|
||||
Scenario: Testbot - Protobuffer import, empty dataset
|
||||
Given the node map
|
||||
| |
|
||||
|
||||
Given the ways
|
||||
| nodes |
|
||||
|
||||
When I preprocess data
|
||||
Then "osrm-extract" should return code 255
|
||||
|
||||
|
||||
Scenario: Testbot - Protobuffer import, streetnames with UTF characters
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
|
||||
And the ways
|
||||
| nodes | name |
|
||||
| ab | Scandinavian København |
|
||||
| bc | Japanese 東京 |
|
||||
| cd | Cyrillic Москва |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | Scandinavian København |
|
||||
| b | c | Japanese 東京 |
|
||||
| c | d | Cyrillic Москва |
|
||||
|
||||
Scenario: Testbot - Protobuffer import, bearing af 45 degree intervals
|
||||
Given the node map
|
||||
| b | a | h |
|
||||
| c | x | g |
|
||||
| d | e | f |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| xa |
|
||||
| xb |
|
||||
| xc |
|
||||
| xd |
|
||||
| xe |
|
||||
| xf |
|
||||
| xg |
|
||||
| xh |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | compass | bearing |
|
||||
| x | a | xa | N | 0 |
|
||||
| x | b | xb | NW | 315 |
|
||||
| x | c | xc | W | 270 |
|
||||
| x | d | xd | SW | 225 |
|
||||
| x | e | xe | S | 180 |
|
||||
| x | f | xf | SE | 135 |
|
||||
| x | g | xg | E | 90 |
|
||||
| x | h | xh | NE | 45 |
|
||||
|
||||
|
||||
Scenario: Testbot - Protobuffer import, rraffic signals should incur a delay
|
||||
Given the node map
|
||||
| a | b | c |
|
||||
| d | e | f |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| e | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abc |
|
||||
| def |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time | distance |
|
||||
| a | c | abc | 20s +-1 | 200m +-1 |
|
||||
| d | f | def | 27s +-1 | 200m +-1 |
|
Loading…
Reference in New Issue
Block a user