cuke test roundabout exit nr

This commit is contained in:
Emil Tin 2013-07-30 17:58:00 +02:00
parent cb28b2de07
commit a45215ddf2
3 changed files with 25 additions and 21 deletions

View File

@ -6,11 +6,11 @@ Feature: Roundabout Instructions
Scenario: Bicycle - Roundabout instructions Scenario: Bicycle - Roundabout instructions
Given the node map Given the node map
| | | t | | |
| | | b | | |
| s | a | | c | u |
| | | d | | |
| | | v | | | | | | v | | |
| | | d | | |
| s | a | | c | u |
| | | b | | |
| | | t | | |
And the ways And the ways
| nodes | junction | | nodes | junction |
@ -21,10 +21,10 @@ Feature: Roundabout Instructions
| abcda | roundabout | | abcda | roundabout |
When I route I should get When I route I should get
| from | to | route | turns | | from | to | route | turns |
| s | v | sa,vd | head,enter_roundabout,destination | | s | t | sa,tb | head,enter_roundabout-1,destination |
| s | u | sa,uc | head,enter_roundabout,destination | | s | u | sa,uc | head,enter_roundabout-2,destination |
| s | t | sa,tb | head,enter_roundabout,destination | | s | v | sa,vd | head,enter_roundabout-3,destination |
| u | t | uc,tb | head,enter_roundabout,destination | | u | v | uc,vd | head,enter_roundabout-1,destination |
| u | s | uc,sa | head,enter_roundabout,destination | | u | s | uc,sa | head,enter_roundabout-2,destination |
| u | v | uc,vd | head,enter_roundabout,destination | | u | t | uc,tb | head,enter_roundabout-3,destination |

View File

@ -21,10 +21,10 @@ Feature: Roundabout Instructions
| abcda | roundabout | | abcda | roundabout |
When I route I should get When I route I should get
| from | to | route | turns | | from | to | route | turns |
| s | v | sa,vd | head,enter_roundabout,destination | | s | t | sa,tb | head,enter_roundabout-1,destination |
| s | u | sa,uc | head,enter_roundabout,destination | | s | u | sa,uc | head,enter_roundabout-2,destination |
| s | t | sa,tb | head,enter_roundabout,destination | | s | v | sa,vd | head,enter_roundabout-3,destination |
| u | t | uc,tb | head,enter_roundabout,destination | | u | v | uc,vd | head,enter_roundabout-1,destination |
| u | s | uc,sa | head,enter_roundabout,destination | | u | s | uc,sa | head,enter_roundabout-2,destination |
| u | v | uc,vd | head,enter_roundabout,destination | | u | t | uc,tb | head,enter_roundabout-3,destination |

View File

@ -122,9 +122,13 @@ def turn_list instructions
16 => :enter_contraflow, 16 => :enter_contraflow,
17 => :leave_contraflow 17 => :leave_contraflow
} }
instructions. # replace instructions codes with strings
map { |r| types[r[0].to_i].to_s }. # "11-3" (enter roundabout and leave a 3rd exit) gets converted to "enter_roundabout-3"
join(',') instructions.map do |r|
r[0].to_s.gsub!(/^\d*/) do |match|
types[match.to_i].to_s
end
end.join(',')
end end
def mode_list instructions def mode_list instructions