-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathexport_test.go
More file actions
32 lines (30 loc) · 845 Bytes
/
export_test.go
File metadata and controls
32 lines (30 loc) · 845 Bytes
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
package ch
import (
"log"
"testing"
)
func TestExport(t *testing.T) {
g := Graph{}
err := graphFromCSV(&g, "data/pgrouting_osm.csv")
if err != nil {
t.Error(err)
}
t.Log("Please wait until contraction hierarchy is prepared")
g.PrepareContractionHierarchies()
t.Log("TestExport is starting...")
correctNumShortcuts := int64(394840)
correctNumVertices := 187853
evaluatedShortcuts := g.GetShortcutsNum()
if evaluatedShortcuts != correctNumShortcuts {
t.Errorf("Number of contractions should be %d, but got %d", correctNumShortcuts, evaluatedShortcuts)
}
if len(g.Vertices) != correctNumVertices {
t.Errorf("Number of vertices should be %d, but got %d", correctNumVertices, len(g.Vertices))
}
err = g.ExportToFile("data/export_pgrouting.csv")
if err != nil {
t.Error(err)
return
}
log.Println("TestExport is Ok!")
}