@routing  @guidance @perceived-angles
Feature: Simple Turns

    Background:
        Given the profile "car"
        Given a grid size of 5 meters

    Scenario: Turning into splitting road
        Given the node map
            """
              a
              b


            c   d

                  e

                f
            """

        And the ways
            | nodes | name | highway | oneway |
            | ab    | road | primary | no     |
            | bc    | road | primary | yes    |
            | fdb   | road | primary | yes    |
            | de    | turn | primary | no     |

        When I route I should get
            | waypoints | turns                           | route          |
            | f,a       | depart,arrive                   | road,road      |
            | e,a       | depart,turn slight right,arrive | turn,road,road |

    Scenario: Turning into splitting road
        Given the node map
        """
              a
            g-b
              /\
             /  \
            c   d
                |\
                | e
                |
                f
        """

        And the ways
            | nodes | name | highway | oneway |
            | ab    | road | primary | no     |
            | bc    | road | primary | yes    |
            | fdb   | road | primary | yes    |
            | de    | turn | primary | no     |
            | bg    | left | primary | yes    |

        When I route I should get
            | waypoints | turns                                     | route               |
            | f,a       | depart,arrive                             | road,road           |
            | e,a       | depart,turn slight right,arrive           | turn,road,road      |
            | e,g       | depart,turn slight right,turn left,arrive | turn,road,left,left |
            | f,g       | depart,turn left,arrive                   | road,left,left      |
            | f,c       | depart,continue uturn,arrive              | road,road,road      |

    Scenario: Middle Island
        Given the node map
            """
              a

              b
            c   h




            d   g
              e

              f
            """

        And the ways
            | nodes | name | oneway |
            | ab    | road | no     |
            | ef    | road | no     |
            | bcde  | road | yes    |
            | eghb  | road | yes    |

        When I route I should get
            | waypoints | turns         | route     |
            | a,f       | depart,arrive | road,road |
            | c,f       | depart,arrive | road,road |
            | f,a       | depart,arrive | road,road |
            | g,a       | depart,arrive | road,road |

    Scenario: Middle Island Over Bridge
        Given the node map
            """
              a

              b
            c   h


            1   2

            d   g
              e

              f
            """

        And the ways
            | nodes | name   | oneway |
            | ab    | road   | no     |
            | ef    | road   | no     |
            | bc    | road   | yes    |
            | cd    | bridge | yes    |
            | de    | road   | yes    |
            | eg    | road   | yes    |
            | gh    | bridge | yes    |
            | hb    | road   | yes    |

        When I route I should get
            | waypoints | turns                           | route            |
            | a,f       | depart,arrive                   | road,road        |
            | c,f       | depart,new name straight,arrive | bridge,road,road |
            | 1,f       | depart,new name straight,arrive | bridge,road,road |
            | f,a       | depart,arrive                   | road,road        |
            | g,a       | depart,new name straight,arrive | bridge,road,road |
            | 2,a       | depart,new name straight,arrive | bridge,road,road |

    @negative
    Scenario: Don't Collapse Places:
        Given the node map
            """
                        h
                        g




            a b                   e f




                        c
                        d
            """

        And the ways
            | nodes | name   | oneway |
            | ab    | place  | no     |
            | cd    | bottom | no     |
            | ef    | place  | no     |
            | gh    | top    | no     |
            | bcegb | place  | yes    |

        When I route I should get
            | waypoints | turns                                             | route                      |
            | a,d       | depart,turn right,arrive                          | place,bottom,bottom        |
            | a,f       | depart,continue left,continue right,arrive        | place,place,place,place    |
            | d,f       | depart,turn right,continue right,arrive           | bottom,place,place,place   |
            | d,h       | depart,turn right,continue left,turn right,arrive | bottom,place,place,top,top |

    @bug @not-sorted @3179
    Scenario: Adjusting road angles to not be sorted
        Given the node map
            """
                                 g
                                |
                               |
                              |
                             _e - - - - - - - - - f
                           /
            a - - - - -b <
                     i     \ _
                h             c - - - - - - - - - d

            """

        And the ways
            | nodes | name  | oneway |
            | ab    | road  | no     |
            | febcd | road  | yes    |
            | ge    | in    | yes    |
            | eh    | right | yes    |
            | ei    | left  | yes    |

        When I route I should get
            | waypoints | route        |
            | g,a       | in,road,road |
