forked from cridenour/go-postgis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoint_test.go
103 lines (77 loc) · 2.28 KB
/
point_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package postgis
import (
"testing"
_ "github.com/lib/pq"
)
func TestPoint(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := Point{-84.5014, 39.1064}
var newPoint Point
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("Point did not return itself through PostGIS.")
}
}
func TestPointZ(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := PointZ{-84.5014, 39.1064, 167.9448}
var newPoint PointZ
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("PointZ did not return itself through PostGIS.")
}
}
func TestPointM(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := PointM{-84.5014, 39.1064, 1.0}
var newPoint PointM
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("PointM did not return itself through PostGIS.")
}
}
func TestPointZM(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := PointZM{-84.5014, 39.1064, 167.9448, 1.0}
var newPoint PointZM
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("PointZM did not return itself through PostGIS.")
}
}
func TestPointS(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := PointS{4326, -84.5014, 39.1064}
var newPoint PointS
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("PointS did not return itself through PostGIS.")
}
}
func TestPointZS(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := PointZS{4326, -84.5014, 39.1064, 167.9448}
var newPoint PointZS
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("PointZS did not return itself through PostGIS.")
}
}
func TestPointMS(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := PointMS{4326, -84.5014, 39.1064, 1.0}
var newPoint PointMS
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("PointMS did not return itself through PostGIS.")
}
}
func TestPointZMS(t *testing.T) {
db := openTestConn(t)
defer db.Close()
point := PointZMS{4326, -84.5014, 39.1064, 167.9448, 1.0}
var newPoint PointZMS
if ok, err := compareGeometry(db, &point, &newPoint); !ok || err != nil {
t.Error("PointZMS did not return itself through PostGIS.")
}
}