-
Notifications
You must be signed in to change notification settings - Fork 0
/
raptor_test.go
50 lines (43 loc) · 893 Bytes
/
raptor_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
package bifrost
import (
"github.com/Vector-Hector/fptf"
"testing"
"time"
)
var b *Bifrost
var r *Rounds
func init() {
b = DefaultBifrost
err := b.LoadData(&LoadOptions{
OsmPaths: []string{"data/mvv/oberbayern-latest.osm.pbf"},
GtfsPaths: []string{"data/mvv/gtfs/"},
BifrostPath: "data/mvv/munich.bifrost",
})
if err != nil {
panic(err)
}
r = b.NewRounds()
}
func TestRaptor(t *testing.T) {
origin := &fptf.Location{
Name: "München Hbf",
Longitude: 11.5596949,
Latitude: 48.140262,
}
dest := &fptf.Location{
Name: "Marienplatz",
Longitude: 11.5757167,
Latitude: 48.1378071,
}
departureTime, err := time.Parse(time.RFC3339, "2023-12-12T08:30:00Z")
if err != nil {
panic(err)
}
_, err = b.Route(r, []SourceLocation{{
Location: origin,
Departure: departureTime,
}}, dest, ModeTransit, true)
if err != nil {
panic(err)
}
}