summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/icrowley/fake/geo_test.go
blob: d337b0f209103b94d10c9bf981e7cf2d28b6d7aa (plain)
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
package fake

import (
	"testing"
)

func TestGeo(t *testing.T) {
	for _, lang := range GetLangs() {
		SetLang(lang)

		f := Latitude()
		if f < -90 || f > 90 {
			t.Errorf("Latitude failed with lang %s", lang)
		}

		i := LatitudeDegrees()
		if i < -180 || i > 180 {
			t.Errorf("LatitudeDegrees failed with lang %s", lang)
		}

		i = LatitudeMinutes()
		if i < 0 || i >= 60 {
			t.Errorf("LatitudeMinutes failed with lang %s", lang)
		}

		i = LatitudeSeconds()
		if i < 0 || i >= 60 {
			t.Errorf("LatitudeSeconds failed with lang %s", lang)
		}

		s := LatitudeDirection()
		if s != "N" && s != "S" {
			t.Errorf("LatitudeDirection failed with lang %s", lang)
		}

		f = Longitude()
		if f < -180 || f > 180 {
			t.Errorf("Longitude failed with lang %s", lang)
		}

		i = LongitudeDegrees()
		if i < -180 || i > 180 {
			t.Errorf("LongitudeDegrees failed with lang %s", lang)
		}

		i = LongitudeMinutes()
		if i < 0 || i >= 60 {
			t.Errorf("LongitudeMinutes failed with lang %s", lang)
		}

		i = LongitudeSeconds()
		if i < 0 || i >= 60 {
			t.Errorf("LongitudeSeconds failed with lang %s", lang)
		}

		s = LongitudeDirection()
		if s != "W" && s != "E" {
			t.Errorf("LongitudeDirection failed with lang %s", lang)
		}
	}
}