add test for roundabout with oneone links

This commit is contained in:
Emil Tin 2014-05-20 13:26:16 +02:00
parent 3968349480
commit bddad0c57c
2 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,77 @@
@routing @testbot @roundabout @instruction
Feature: Roundabout Instructions
Background:
Given the profile "testbot"
Scenario: Testbot - Roundabout
Given the node map
| | | v | | |
| | | d | | |
| s | a | | c | u |
| | | b | | |
| | | t | | |
And the ways
| nodes | junction |
| sa | |
| tb | |
| uc | |
| vd | |
| abcda | roundabout |
When I route I should get
| from | to | route | turns |
| s | t | sa,tb | head,enter_roundabout-1,destination |
| s | u | sa,uc | head,enter_roundabout-2,destination |
| s | v | sa,vd | head,enter_roundabout-3,destination |
| t | u | tb,uc | head,enter_roundabout-1,destination |
| t | v | tb,vd | head,enter_roundabout-2,destination |
| t | s | tb,sa | head,enter_roundabout-3,destination |
| u | v | uc,vd | head,enter_roundabout-1,destination |
| u | s | uc,sa | head,enter_roundabout-2,destination |
| u | t | uc,tb | head,enter_roundabout-3,destination |
| v | s | vd,sa | head,enter_roundabout-1,destination |
| v | t | vd,tb | head,enter_roundabout-2,destination |
| v | u | vd,uc | head,enter_roundabout-3,destination |
@bug
Scenario: Testbot - Roundabout with oneway links
Given the node map
| | | p | o | | |
| | | h | g | | |
| i | a | | | f | n |
| j | b | | | e | m |
| | | c | d | | |
| | | k | l | | |
And the ways
| nodes | junction | oneway |
| ai | | yes |
| jb | | yes |
| ck | | yes |
| ld | | yes |
| em | | yes |
| nf | | yes |
| go | | yes |
| ph | | yes |
| abcdefgha | roundabout | |
When I route I should get
| from | to | route | turns |
| j | k | jb,ck | head,enter_roundabout-1,destination |
| j | m | jb,em | head,enter_roundabout-2,destination |
| j | o | jb,go | head,enter_roundabout-3,destination |
| j | i | jb,ai | head,enter_roundabout-4,destination |
| l | m | ld,em | head,enter_roundabout-1,destination |
| l | o | ld,go | head,enter_roundabout-2,destination |
| l | i | ld,ai | head,enter_roundabout-3,destination |
| l | k | ld,ck | head,enter_roundabout-4,destination |
| n | o | nf,go | head,enter_roundabout-1,destination |
| n | i | nf,ai | head,enter_roundabout-2,destination |
| n | k | nf,ck | head,enter_roundabout-3,destination |
| n | m | nf,em | head,enter_roundabout-4,destination |
| p | i | ph,ai | head,enter_roundabout-1,destination |
| p | k | ph,ck | head,enter_roundabout-2,destination |
| p | m | ph,em | head,enter_roundabout-3,destination |
| p | o | ph,go | head,enter_roundabout-4,destination |

View File

@ -55,6 +55,7 @@ function way_function (way)
local maxspeed = tonumber(way.tags:Find ( "maxspeed")) local maxspeed = tonumber(way.tags:Find ( "maxspeed"))
local maxspeed_forward = tonumber(way.tags:Find( "maxspeed:forward")) local maxspeed_forward = tonumber(way.tags:Find( "maxspeed:forward"))
local maxspeed_backward = tonumber(way.tags:Find( "maxspeed:backward")) local maxspeed_backward = tonumber(way.tags:Find( "maxspeed:backward"))
local junction = way.tags:Find("junction")
way.name = name way.name = name
@ -96,12 +97,16 @@ function way_function (way)
way.direction = Way.bidirectional way.direction = Way.bidirectional
elseif oneway == "-1" then elseif oneway == "-1" then
way.direction = Way.opposite way.direction = Way.opposite
elseif oneway == "yes" or oneway == "1" or oneway == "true" then elseif oneway == "yes" or oneway == "1" or oneway == "true" or junction == "roundabout" then
way.direction = Way.oneway way.direction = Way.oneway
else else
way.direction = Way.bidirectional way.direction = Way.bidirectional
end end
if junction == 'roundabout' then
way.roundabout = true
end
way.type = 1 way.type = 1
return 1 return 1
end end