-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathgeo_test.go
49 lines (38 loc) · 936 Bytes
/
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
package ics
import (
"testing"
)
func TestLongitudeReturnsError(t *testing.T) {
geo := NewGeo("1", "badLong")
_, err := geo.Longitude()
if err == nil {
t.Error("Expected error when getting Longitude but err was nil.")
}
}
func TestLongitudeReturnsValue(t *testing.T) {
geo := NewGeo("1", "123")
long, err := geo.Longitude()
if err != nil {
t.Error("Error when getting longitude.")
}
if long != 123 {
t.Errorf("Expected longitude value 123, but received %v", long)
}
}
func TestLatitudeReturnsError(t *testing.T) {
geo := NewGeo("badlat", "1")
_, err := geo.Latitude()
if err == nil {
t.Error("Expected error when getting Latitude but err was nil.")
}
}
func TestLatitudeReturnsValue(t *testing.T) {
geo := NewGeo("321", "1")
lat, err := geo.Latitude()
if err != nil {
t.Error("Error when getting latitude.")
}
if lat != 321 {
t.Errorf("Expected latitude value 321, but received %v", lat)
}
}