tests for signal penalty. renamed 'given the nodes' to 'given the node map' and introduced new 'given the nodes' to set node tags
This commit is contained in:
parent
a65339d011
commit
9dfbd5f671
@ -2,7 +2,7 @@
|
||||
Feature: Handle bad data in a graceful manner
|
||||
|
||||
Scenario: Empty dataset
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
|
||||
Given the ways
|
||||
@ -13,7 +13,7 @@ Feature: Handle bad data in a graceful manner
|
||||
| a | b | |
|
||||
|
||||
Scenario: Start/end point at the same location
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| 1 | 2 |
|
||||
|
||||
@ -29,7 +29,7 @@ Feature: Handle bad data in a graceful manner
|
||||
| 2 | 2 | |
|
||||
|
||||
Scenario: Start/end point far outside data area
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
|
||||
| a | b | | | | | | | | | | | | | | | | | | | | | | | | | | | 2 |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3 |
|
||||
|
@ -3,7 +3,7 @@ Feature: Basic Routing
|
||||
|
||||
@smallest
|
||||
Scenario: A single way with two nodes
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
|
||||
And the ways
|
||||
@ -16,7 +16,7 @@ Feature: Basic Routing
|
||||
| b | a | ab |
|
||||
|
||||
Scenario: Routing in between two nodes of way
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | 1 | 2 | c | d |
|
||||
|
||||
And the ways
|
||||
@ -29,7 +29,7 @@ Feature: Basic Routing
|
||||
| 2 | 1 | abcd |
|
||||
|
||||
Scenario: Routing between the middle nodes of way
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c | d | e | f |
|
||||
|
||||
And the ways
|
||||
@ -52,7 +52,7 @@ Feature: Basic Routing
|
||||
| e | d | abcdef |
|
||||
|
||||
Scenario: Two ways connected in a straight line
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c |
|
||||
|
||||
And the ways
|
||||
@ -70,7 +70,7 @@ Feature: Basic Routing
|
||||
| c | b | bc |
|
||||
|
||||
Scenario: 2 unconnected parallel ways
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| c | d |
|
||||
|
||||
@ -93,7 +93,7 @@ Feature: Basic Routing
|
||||
| d | a | |
|
||||
|
||||
Scenario: 3 ways connected in a triangle
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | | b |
|
||||
| | | |
|
||||
| | c | |
|
||||
@ -114,7 +114,7 @@ Feature: Basic Routing
|
||||
| c | b | bc |
|
||||
|
||||
Scenario: To ways connected at a 45 degree angle
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | | |
|
||||
| b | | |
|
||||
| c | d | e |
|
||||
|
@ -3,7 +3,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: Distance of a winding south-north path
|
||||
Given a grid size of 10 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| d | c |
|
||||
| e | f |
|
||||
@ -25,7 +25,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: Distance of a winding east-west path
|
||||
Given a grid size of 10 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | d | e | h |
|
||||
| b | c | f | g |
|
||||
|
||||
@ -45,7 +45,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: Distances when traversing part of a way
|
||||
Given a grid size of 100 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | 0 | 1 | 2 |
|
||||
| 9 | | | 3 |
|
||||
| 8 | | | 4 |
|
||||
@ -82,7 +82,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: Geometric distances
|
||||
Given a grid size of 1000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| v | w | y | a | b | c | d |
|
||||
| u | | | | | | e |
|
||||
| t | | | | | | f |
|
||||
@ -147,7 +147,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: 1m distances
|
||||
Given a grid size of 1 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -166,7 +166,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: 10m distances
|
||||
Given a grid size of 10 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -185,7 +185,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: 100m distances
|
||||
Given a grid size of 100 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -204,7 +204,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: 1km distance
|
||||
Given a grid size of 1000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -223,7 +223,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: 10km distances
|
||||
Given a grid size of 10000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -242,7 +242,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: 100km distances
|
||||
Given a grid size of 100000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -261,7 +261,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: 1000km distances
|
||||
Given a grid size of 1000000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -280,7 +280,7 @@ Feature: Distance calculation
|
||||
|
||||
Scenario: Angles at 1000km scale
|
||||
Given a grid size of 1000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | | | b | | | |
|
||||
| | | | | | | c |
|
||||
| a | | | | | | |
|
||||
|
@ -2,7 +2,7 @@
|
||||
Feature: Handle ferry routes
|
||||
|
||||
Scenario: Use a ferry route
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c | | |
|
||||
| | | d | | |
|
||||
| | | e | f | g |
|
||||
|
@ -2,7 +2,7 @@
|
||||
Feature: Street names in instructions
|
||||
|
||||
Scenario: A named street
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| | c |
|
||||
|
||||
@ -16,7 +16,7 @@ Feature: Street names in instructions
|
||||
| a | c | My Way,Your Way |
|
||||
|
||||
Scenario: Use way type to describe unnamed ways
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c |
|
||||
|
||||
And the ways
|
||||
@ -29,7 +29,7 @@ Feature: Street names in instructions
|
||||
| a | c | cycleway,trac |
|
||||
|
||||
Scenario: Don't create instructions for every node of unnamed ways
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
|
||||
And the ways
|
||||
|
@ -15,7 +15,7 @@ Feature: Oneway streets
|
||||
| primary | -1 | | x |
|
||||
|
||||
Scenario: Around the Block
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| d | c |
|
||||
|
||||
|
99
features/penalty.feature
Normal file
99
features/penalty.feature
Normal file
@ -0,0 +1,99 @@
|
||||
@routing @penalty
|
||||
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
|
||||
| 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 |
|
||||
| a | c | abc | 38s |
|
||||
| d | f | def | 58s |
|
||||
|
||||
Scenario: Passing multiple traffic signals should incur a accumulated delay
|
||||
Given the node map
|
||||
| a | b | c | d | e |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
| c | traffic_signals |
|
||||
| d | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abcde |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | e | abcde | 136s |
|
||||
|
||||
Scenario: Starting or ending at a traffic signal should not incur a delay
|
||||
Given the node map
|
||||
| a | b | c |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | abc | 19s |
|
||||
| b | a | abc | 19s |
|
||||
| b | c | abc | 19s |
|
||||
| c | b | abc | 19s |
|
||||
|
||||
Scenario: Routing between signals on the same way should not incur a delay
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| a | traffic_signals |
|
||||
| d | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abcd |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| b | c | abcd | 19s |
|
||||
| c | b | abcd | 19s |
|
||||
|
||||
Scenario: Prefer faster route without traffic signals
|
||||
Given the node map
|
||||
| a | b | c |
|
||||
| | d | |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abc |
|
||||
| adc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | c | adc |
|
@ -8,7 +8,7 @@ Feature: Turn restrictions
|
||||
|
||||
@no_turning
|
||||
Scenario: No left turn
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
@ -32,7 +32,7 @@ Feature: Turn restrictions
|
||||
|
||||
@no_turning
|
||||
Scenario: No right turn
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
@ -56,7 +56,7 @@ Feature: Turn restrictions
|
||||
|
||||
@no_turning
|
||||
Scenario: No u-turn
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
@ -80,7 +80,7 @@ Feature: Turn restrictions
|
||||
|
||||
@no_turning
|
||||
Scenario: Handle any no_* relation
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
@ -104,7 +104,7 @@ Feature: Turn restrictions
|
||||
|
||||
@only_turning
|
||||
Scenario: Only left turn
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
@ -128,7 +128,7 @@ Feature: Turn restrictions
|
||||
|
||||
@only_turning
|
||||
Scenario: Only right turn
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
@ -152,7 +152,7 @@ Feature: Turn restrictions
|
||||
|
||||
@only_turning
|
||||
Scenario: Only straight on
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
@ -176,7 +176,7 @@ Feature: Turn restrictions
|
||||
|
||||
@no_turning
|
||||
Scenario: Handle any only_* restriction
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | n | |
|
||||
| w | j | e |
|
||||
| | s | |
|
||||
|
@ -2,7 +2,7 @@
|
||||
Feature: Snap start/end point to the nearest way
|
||||
|
||||
Scenario: Snap to nearest protruding oneway
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | 1 | | 2 | |
|
||||
| 8 | | n | | 3 |
|
||||
| | w | c | e | |
|
||||
@ -28,7 +28,7 @@ Feature: Snap start/end point to the nearest way
|
||||
| 8 | c | wc |
|
||||
|
||||
Scenario: Snap to nearest edge of a square
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 3 | a | | u |
|
||||
| 2 | | | |
|
||||
@ -47,7 +47,7 @@ Feature: Snap start/end point to the nearest way
|
||||
| 7 | b | aub |
|
||||
|
||||
Scenario: Snap to edge right under start/end point
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| d | e | f | g |
|
||||
| c | | | h |
|
||||
| b | | | i |
|
||||
@ -75,7 +75,7 @@ Feature: Snap start/end point to the nearest way
|
||||
|
||||
Scenario: Snap to correct way at large scales
|
||||
Given a grid size of 1000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | | | a |
|
||||
| x | | | b |
|
||||
| | | | c |
|
||||
|
@ -12,7 +12,7 @@ Given /^a grid size of (\d+) meters$/ do |meters|
|
||||
set_grid_size meters
|
||||
end
|
||||
|
||||
Given /^the nodes$/ do |table|
|
||||
Given /^the node map$/ do |table|
|
||||
table.raw.each_with_index do |row,ri|
|
||||
row.each_with_index do |name,ci|
|
||||
unless name.empty?
|
||||
@ -29,6 +29,16 @@ Given /^the nodes$/ do |table|
|
||||
end
|
||||
end
|
||||
|
||||
Given /^the nodes$/ do |table|
|
||||
table.hashes.each do |row|
|
||||
name = row.delete 'node'
|
||||
raise "***invalid node name '#{c}', must be single characters" unless name.size == 1
|
||||
node = find_node_by_name(name)
|
||||
raise "*** unknown node '#{c}'" unless node
|
||||
node << row
|
||||
end
|
||||
end
|
||||
|
||||
Given /^the ways$/ do |table|
|
||||
table.hashes.each do |row|
|
||||
way = OSM::Way.new make_osm_id, OSM_USER, OSM_TIMESTAMP
|
||||
@ -37,7 +47,7 @@ Given /^the ways$/ do |table|
|
||||
nodes = row.delete 'nodes'
|
||||
raise "*** duplicate way '#{nodes}'" if name_way_hash[nodes]
|
||||
nodes.each_char do |c|
|
||||
raise "*** node invalid name '#{c}', must be single characters" unless c.size == 1
|
||||
raise "***invalid node name '#{c}', must be single characters" unless c.size == 1
|
||||
raise "*** ways cannot use numbered nodes, '#{name}'" unless c.match /[a-z]/
|
||||
node = find_node_by_name(c)
|
||||
raise "*** unknown node '#{c}'" unless node
|
||||
|
@ -12,7 +12,7 @@ Feature: Estimation of travel time
|
||||
|
||||
Scenario: Basic travel time, 1m scale
|
||||
Given a grid size of 1 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| h | a | b |
|
||||
| g | x | c |
|
||||
| f | e | d |
|
||||
@ -41,7 +41,7 @@ Feature: Estimation of travel time
|
||||
|
||||
Scenario: Basic travel time, 100m scale
|
||||
Given a grid size of 100 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| h | a | b |
|
||||
| g | x | c |
|
||||
| f | e | d |
|
||||
@ -70,7 +70,7 @@ Feature: Estimation of travel time
|
||||
|
||||
Scenario: Basic travel time, 10km scale
|
||||
Given a grid size of 10000 meters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| h | a | b |
|
||||
| g | x | c |
|
||||
| f | e | d |
|
||||
@ -98,7 +98,7 @@ Feature: Estimation of travel time
|
||||
| x | h | xh | 3400s |
|
||||
|
||||
Scenario: Time of travel depending on way type
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b |
|
||||
| c | d |
|
||||
|
||||
@ -113,7 +113,7 @@ Feature: Estimation of travel time
|
||||
| c | d | cd | 72s |
|
||||
|
||||
Scenario: Time of travel on a series of ways
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
|
||||
And the ways
|
||||
@ -129,7 +129,7 @@ Feature: Estimation of travel time
|
||||
| a | d | ab,bc,cd | 72s |
|
||||
|
||||
Scenario: Time of travel on a winding way
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | | | | |
|
||||
| | c | d | e | | i |
|
||||
| | | | f | g | h |
|
||||
@ -145,7 +145,7 @@ Feature: Estimation of travel time
|
||||
| a | i | abcdefghi | 192s |
|
||||
|
||||
Scenario: Time of travel on combination of road types
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c | d | e |
|
||||
|
||||
And the ways
|
||||
@ -161,7 +161,7 @@ Feature: Estimation of travel time
|
||||
| a | e | abc,cde | 192s |
|
||||
|
||||
Scenario: Time of travel on part of a way
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | 1 |
|
||||
| | 2 |
|
||||
| | 3 |
|
||||
|
@ -2,7 +2,7 @@
|
||||
Feature: Basic Routing
|
||||
|
||||
Scenario: Streetnames with UTF characters
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
|
||||
And the ways
|
||||
|
@ -2,7 +2,7 @@
|
||||
Feature: Choosing route based on length, speed, etc
|
||||
|
||||
Scenario: Pick the geometrically shortest route, way types being equal
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| | s | |
|
||||
| | t | |
|
||||
| a | | b |
|
||||
@ -18,7 +18,7 @@ Feature: Choosing route based on length, speed, etc
|
||||
| a | b | atb |
|
||||
|
||||
Scenario: Pick the fastest way type, lengths being equal
|
||||
Given the nodes
|
||||
Given the node map
|
||||
| a | s |
|
||||
| p | b |
|
||||
|
||||
|
@ -25,3 +25,4 @@
|
||||
ferry = 5
|
||||
|
||||
excludeFromGrid = ferry
|
||||
trafficSignalPenalty = 10
|
Loading…
Reference in New Issue
Block a user