Skip to content

Commit

Permalink
tests for signal penalty. renamed 'given the nodes' to 'given the nod…
Browse files Browse the repository at this point in the history
…e map' and introduced new 'given the nodes' to set node tags
  • Loading branch information
emiltin committed Mar 8, 2012
1 parent a65339d commit 9dfbd5f
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 52 deletions.
6 changes: 3 additions & 3 deletions features/bad.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 |

Expand All @@ -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 |
Expand Down
14 changes: 7 additions & 7 deletions features/basic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 |

Expand All @@ -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 | |
Expand All @@ -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 |
Expand Down
24 changes: 12 additions & 12 deletions features/distance.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |

Expand All @@ -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 |
Expand Down Expand Up @@ -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 |
Expand Down Expand Up @@ -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 |

Expand All @@ -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 |

Expand All @@ -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 |

Expand All @@ -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 |

Expand All @@ -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 |

Expand All @@ -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 |

Expand All @@ -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 |

Expand All @@ -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 | | | | | | |
Expand Down
2 changes: 1 addition & 1 deletion features/ferry.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
6 changes: 3 additions & 3 deletions features/names.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Feature: Street names in instructions

Scenario: A named street
Given the nodes
Given the node map
| a | b |
| | c |

Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion features/oneway.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand Down
99 changes: 99 additions & 0 deletions features/penalty.feature
Original file line number Diff line number Diff line change
@@ -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 |
Loading

0 comments on commit 9dfbd5f

Please sign in to comment.