-
Notifications
You must be signed in to change notification settings - Fork 13
/
coordinates_test.go
46 lines (42 loc) · 1.33 KB
/
coordinates_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
// Copyright (c) 2015, Marios Andreopoulos.
//
// This file is part of aislib.
//
// Aislib is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aislib is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with aislib. If not, see <http://www.gnu.org/licenses/>.
package aislib
import (
"fmt"
"testing"
)
func TestCoordinatesDeg2Human(t *testing.T) {
cases := []struct {
lon, lat float64
want string
}{
{-3.56725, 53.84251666666667, " 3°34.0350'W 53°50.5510N"},
{31.130165, -29.784113333333334, " 31°07.8099'E 29°47.0468S"},
}
for _, c := range cases {
got := CoordinatesDeg2Human(c.lon, c.lat)
if got != c.want {
fmt.Println("Got : ", got)
fmt.Println("Want: ", c.want)
t.Errorf("CoordinatesDeg2Human(lon, lat float64)")
}
}
}
func ExampleCoordinatesDeg2Human() {
fmt.Println(CoordinatesDeg2Human(-3.56725, 53.84251666666667))
// Output: 3°34.0350'W 53°50.5510N
}