update maxspeed tests, remove maxspeed from foot profile

This commit is contained in:
Emil Tin 2013-02-04 11:15:06 +01:00
parent d67ac1a708
commit 97f1dc0749
5 changed files with 82 additions and 53 deletions

View File

@ -4,30 +4,35 @@ Feature: Bike - Max speed restrictions
Background: Use specific speeds Background: Use specific speeds
Given the profile "bicycle" Given the profile "bicycle"
Scenario: Bike - Respect maxspeeds when lower that way type speed Scenario: Bicycle - Respect maxspeeds when lower that way type speed
Given the node map Then routability should be
| a | b | c | | highway | maxspeed | bothw |
| residential | | 40s ~10% |
| residential | 10 | 72s ~10% |
And the ways Scenario: Bicycle - Ignore maxspeed when higher than way speed
| nodes | highway | maxspeed | Then routability should be
| ab | residential | | | highway | maxspeed | bothw |
| bc | residential | 10 | | residential | | 40s ~10% |
| residential | 80 | 40s ~10% |
When I route I should get @todo
| from | to | route | time | Scenario: Bicycle - Maxspeed formats
| a | b | ab | 20s ~5% | Then routability should be
| b | c | bc | 36s ~5% | | highway | maxspeed | bothw |
| residential | | 40s ~10% |
| residential | 5 | 144s ~10% |
| residential | 5mph | 90s ~10% |
| residential | 5 mph | 90s ~10% |
| residential | 5MPH | 90s ~10% |
| residential | 5 MPH | 90s ~10% |
| trunk | 5unknown | 40s ~10% |
| trunk | 5 unknown | 40s ~10% |
Scenario: Bike - Do not use maxspeed when higher that way type speed @todo
Given the node map Scenario: Bicycle - Maxspeed special tags
| a | b | c | Then routability should be
| highway | maxspeed | bothw |
And the ways | residential | | 40s ~10% |
| nodes | highway | maxspeed | | residential | none | 40s ~10% |
| ab | residential | | | residential | signals | 40s ~10% |
| bc | residential | 80 |
When I route I should get
| from | to | route | time |
| a | b | ab | 20s ~5% |
| b | c | bc | 20s ~5% |

View File

@ -3,32 +3,36 @@ Feature: Car - Max speed restrictions
Background: Use specific speeds Background: Use specific speeds
Given the profile "car" Given the profile "car"
Given a grid size of 1000 meters
Scenario: Car - Respect maxspeeds when lower that way type speed Scenario: Car - Respect maxspeeds when lower that way type speed
Given the node map Then routability should be
| a | b | c | | highway | maxspeed | bothw |
| trunk | | 9s ~10% |
And the ways | trunk | 10 | 72s ~10% |
| nodes | highway | maxspeed |
| ab | trunk | |
| bc | trunk | 10 |
When I route I should get
| from | to | route | time |
| a | b | ab | 42s ~10% |
| b | c | bc | 360s ~10% |
Scenario: Car - Ignore maxspeed when higher than way speed Scenario: Car - Ignore maxspeed when higher than way speed
Given the node map Then routability should be
| a | b | c | | highway | maxspeed | bothw |
| residential | | 29s ~10% |
| residential | 85 | 29s ~10% |
And the ways @todo
| nodes | highway | maxspeed | Scenario: Car - Maxspeed formats
| ab | residential | | Then routability should be
| bc | residential | 85 | | highway | maxspeed | bothw |
| trunk | | 9s ~10% |
| trunk | 10 | 73s ~10% |
| trunk | 10mph | 45s ~10% |
| trunk | 10 mph | 45s ~10% |
| trunk | 10MPH | 45s ~10% |
| trunk | 10 MPH | 45s ~10% |
| trunk | 10unknown | 9s ~10% |
| trunk | 10 unknown | 9s ~10% |
When I route I should get @todo
| from | to | route | time | Scenario: Car - Maxspeed special tags
| a | b | ab | 144s ~10% | Then routability should be
| b | c | bc | 144s ~10% | | highway | maxspeed | bothw |
| trunk | | 9s ~10% |
| trunk | none | 9s ~10% |
| trunk | signals | 9s ~10% |

View File

@ -0,0 +1,20 @@
@routing @maxspeed @foot
Feature: Foot - Ignore max speed restrictions
Background: Use specific speeds
Given the profile "foot"
@todo
Scenario: Foot - Ignore maxspeed
Then routability should be
| highway | maxspeed | bothw |
| residential | | 145s ~10% |
| residential | 1 | 145s ~10% |
| residential | 100 | 145s ~10% |
| residential | 1 | 145s ~10% |
| residential | 1mph | 145s ~10% |
| residential | 1 mph | 145s ~10% |
| residential | 1unknown | 145s ~10% |
| residential | 1 unknown | 145s ~10% |
| residential | none | 145s ~10% |
| residential | signals | 145s ~10% |

View File

@ -0,0 +1,3 @@
def shortcuts_hash
@shortcuts_hash ||= {}
end

View File

@ -152,10 +152,7 @@ function way_function (way, numberOfNodesInWay)
-- Set the avg speed on the way if it is accessible by road class -- Set the avg speed on the way if it is accessible by road class
if (speed_profile[highway] ~= nil and way.speed == -1 ) then if (speed_profile[highway] ~= nil and way.speed == -1 ) then
if (0 < maxspeed and not take_minimum_of_speeds) or (maxspeed == 0) then way.speed = speed_profile[highway]
maxspeed = math.huge
end
way.speed = math.min(speed_profile[highway], maxspeed)
end end
-- Set the avg speed on ways that are marked accessible -- Set the avg speed on ways that are marked accessible