forked from devit-tel/go.osrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
route_test.go
53 lines (47 loc) · 1.16 KB
/
route_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package osrm
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEmptyRouteRequestOptions(t *testing.T) {
req := RouteRequest{}
assert.Equal(
t,
"geometries=polyline6",
req.request().options.encode())
}
func TestRouteRequestOptionsWithBearings(t *testing.T) {
req := RouteRequest{
Bearings: []Bearing{
{60, 380},
{45, 180},
},
ContinueStraight: ContinueStraightTrue,
}
assert.Equal(
t,
"bearings=60%2C380%3B45%2C180&continue_straight=true&geometries=polyline6",
req.request().options.encode())
}
func TestRouteRequestOverviewOption(t *testing.T) {
req := RouteRequest{
Overview: OverviewFull,
ContinueStraight: ContinueStraightTrue,
}
assert.Equal(
t,
"continue_straight=true&geometries=polyline6&overview=full",
req.request().options.encode())
}
func TestRouteRequestGeometryOption(t *testing.T) {
req := RouteRequest{
Geometries: GeometriesPolyline6,
Annotations: AnnotationsFalse,
Steps: StepsFalse,
ContinueStraight: ContinueStraightTrue,
}
assert.Equal(
t,
"annotations=false&continue_straight=true&geometries=polyline6&steps=false",
req.request().options.encode())
}