forked from icrowley/fake
-
Notifications
You must be signed in to change notification settings - Fork 2
/
geo_test.go
83 lines (68 loc) · 1.33 KB
/
geo_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
package fake
import (
"math/rand"
"testing"
)
func TestGeoLongLat(t *testing.T) {
t.Parallel()
f := Latitute()
if f == 0 {
t.Error("Latitude zeroed")
}
f = Longitude()
if f == 0 {
t.Error("Longitude zeroed")
}
}
func TestGeoMinSecs(t *testing.T) {
t.Parallel()
i := LatitudeMinutes()
if i < 0 || i >= 60 {
t.Errorf("LatitudeMinutes failed, got %v", i)
}
i = LatitudeSeconds()
if i < 0 || i >= 60 {
t.Errorf("LatitudeSeconds failed, got %v", i)
}
i = LongitudeMinutes()
if i < 0 || i >= 60 {
t.Errorf("LongitudeMinutes failed, got %v", i)
}
i = LongitudeSeconds()
if i < 0 || i >= 60 {
t.Errorf("LongitudeSeconds failed, got %v", i)
}
}
func TestGeoDegrees(t *testing.T) {
t.Parallel()
i := LatitudeDegrees()
if i < -180 || i > 180 {
t.Errorf("LatitudeDegrees failed, got %v", i)
}
i = LongitudeDegrees()
if i < -180 || i > 180 {
t.Errorf("LongitudeDegrees failed, got %v", i)
}
}
func TestGeoDirection(t *testing.T) {
t.Parallel()
rand.Seed(0)
for i := 0; i < 4; i++ {
t.Run("GeoDirectionLatitude-deterministic", func(t *testing.T) {
t.Parallel()
d := LatitudeDirection()
if d == "" {
t.Fail()
}
})
}
for i := 0; i < 4; i++ {
t.Run("GeoDirectionLatitude-deterministic", func(t *testing.T) {
t.Parallel()
d := LongitudeDirection()
if d == "" {
t.Fail()
}
})
}
}