diff --git a/features/bad.feature b/features/bad.feature index e8bf2288647..72b6bd8e3ae 100644 --- a/features/bad.feature +++ b/features/bad.feature @@ -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 | diff --git a/features/basic.feature b/features/basic.feature index 4682d69d4f2..6283ddac634 100644 --- a/features/basic.feature +++ b/features/basic.feature @@ -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 | diff --git a/features/distance.feature b/features/distance.feature index 27ffc6b69bb..f2492ec7319 100644 --- a/features/distance.feature +++ b/features/distance.feature @@ -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 | | | | | | | diff --git a/features/ferry.feature b/features/ferry.feature index 32b917b0123..e69d7cb7449 100644 --- a/features/ferry.feature +++ b/features/ferry.feature @@ -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 | diff --git a/features/names.feature b/features/names.feature index 828547566e4..25ec2ba5eda 100644 --- a/features/names.feature +++ b/features/names.feature @@ -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 diff --git a/features/oneway.feature b/features/oneway.feature index 4160c60b3bf..caa9afd99b9 100644 --- a/features/oneway.feature +++ b/features/oneway.feature @@ -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 | diff --git a/features/penalty.feature b/features/penalty.feature new file mode 100644 index 00000000000..b2a00199fe3 --- /dev/null +++ b/features/penalty.feature @@ -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 | diff --git a/features/restrictions.feature b/features/restrictions.feature index 8eb738a408b..17949bcaf88 100644 --- a/features/restrictions.feature +++ b/features/restrictions.feature @@ -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 | | diff --git a/features/snap.feature b/features/snap.feature index 5fbb0eb5161..c5b820031bf 100644 --- a/features/snap.feature +++ b/features/snap.feature @@ -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 | diff --git a/features/step_definitions/data.rb b/features/step_definitions/data.rb index e38633eee4d..a3b4220211b 100644 --- a/features/step_definitions/data.rb +++ b/features/step_definitions/data.rb @@ -12,7 +12,7 @@ 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 @@ 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 @@ 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 diff --git a/features/time.feature b/features/time.feature index 24f0a448bb0..564033db28d 100644 --- a/features/time.feature +++ b/features/time.feature @@ -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 | diff --git a/features/utf.feature b/features/utf.feature index 306b4c8fbbf..f4f174d658d 100644 --- a/features/utf.feature +++ b/features/utf.feature @@ -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 diff --git a/features/weight.feature b/features/weight.feature index 873b70aa4cf..40ae95864f3 100644 --- a/features/weight.feature +++ b/features/weight.feature @@ -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 | diff --git a/speedprofiles/bicycle.ini b/speedprofiles/bicycle.ini index d6e6187b771..1664beb884f 100644 --- a/speedprofiles/bicycle.ini +++ b/speedprofiles/bicycle.ini @@ -25,3 +25,4 @@ ferry = 5 excludeFromGrid = ferry + trafficSignalPenalty = 10 \ No newline at end of file