clean up signal penalty test

This commit is contained in:
Emil Tin 2012-09-28 15:57:54 +02:00
parent 4c02542dc5
commit eae9e4bab7
2 changed files with 20 additions and 16 deletions

View File

@ -1,8 +1,8 @@
@routing @penalty @routing @penalty @signal
Feature: Penalties Feature: Penalties
Background: Background:
Given the speedprofile "bicycle" Given the speedprofile "testbot"
Scenario: Passing a traffic signal should incur a delay Scenario: Passing a traffic signal should incur a delay
Given the node map Given the node map
@ -20,8 +20,8 @@ Feature: Penalties
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | c | abc | 38s | | a | c | abc | 20s +-1 |
| d | f | def | 58s | | d | f | def | 50s +-1 |
Scenario: Passing multiple traffic signals should incur a accumulated delay Scenario: Passing multiple traffic signals should incur a accumulated delay
Given the node map Given the node map
@ -39,7 +39,7 @@ Feature: Penalties
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | e | abcde | 136s | | a | e | abcde | 130s +-1 |
Scenario: Starting or ending at a traffic signal should not incur a delay Scenario: Starting or ending at a traffic signal should not incur a delay
Given the node map Given the node map
@ -55,10 +55,8 @@ Feature: Penalties
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | b | abc | 19s | | a | b | abc | 10s +-1 |
| b | a | abc | 19s | | b | a | abc | 10s +-1 |
| b | c | abc | 19s |
| c | b | abc | 19s |
Scenario: Routing between signals on the same way should not incur a delay Scenario: Routing between signals on the same way should not incur a delay
Given the node map Given the node map
@ -75,8 +73,8 @@ Feature: Penalties
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| b | c | abcd | 19s | | b | c | abcd | 10s +-1 |
| c | b | abcd | 19s | | c | b | abcd | 10s +-1 |
Scenario: Prefer faster route without traffic signals Scenario: Prefer faster route without traffic signals
Given the node map Given the node map

View File

@ -14,6 +14,12 @@ speed_profile = {
} }
function node_function (node) function node_function (node)
local traffic_signal = node.tags:Find("highway")
if traffic_signal == "traffic_signals" then
node.traffic_light = true;
-- TODO: a way to set the penalty value
end
return 1 return 1
end end