-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfloat64slices_test.go
More file actions
44 lines (40 loc) · 983 Bytes
/
float64slices_test.go
File metadata and controls
44 lines (40 loc) · 983 Bytes
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
package proj_test
import (
"slices"
"strconv"
"testing"
"github.com/alecthomas/assert/v2"
"github.com/twpayne/go-proj/v11"
)
func TestCoordsToFloat64Slices(t *testing.T) {
for i, tc := range []struct {
coords []proj.Coord
float64Slices [][]float64
}{
{
coords: nil,
float64Slices: nil,
},
{
coords: []proj.Coord{},
float64Slices: [][]float64{},
},
{
coords: []proj.Coord{{1, 2}},
float64Slices: [][]float64{{1, 2, 0, 0}},
},
{
coords: []proj.Coord{{1, 2}, {3, 4}},
float64Slices: [][]float64{{1, 2, 0, 0}, {3, 4, 0, 0}},
},
{
coords: []proj.Coord{{1, 2, 3, 4}, {5, 6, 7, 8}},
float64Slices: [][]float64{{1, 2, 3, 4}, {5, 6, 7, 8}},
},
} {
t.Run(strconv.Itoa(i), func(t *testing.T) {
assert.Equal(t, tc.float64Slices, proj.CoordsToFloat64Slices(slices.Clone(tc.coords)))
assert.Equal(t, tc.coords, proj.Float64SlicesToCoords(slices.Clone(tc.float64Slices)))
})
}
}