-
Notifications
You must be signed in to change notification settings - Fork 0
/
ewkb_test.go
43 lines (36 loc) · 1.09 KB
/
ewkb_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
package ewkb
import "testing"
func TestNewBase(t *testing.T) {
cases := []struct {
name string
byteOrder byte
hasZ, hasM, hasSRID bool
srid int32
}{
{name: "little endian", byteOrder: NDR},
{name: "big endian", byteOrder: XDR},
{name: "has Z", hasZ: true},
{name: "has M", hasM: true},
{name: "has SRID", hasSRID: true, srid: 132},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
b := NewBase(c.byteOrder, c.hasZ, c.hasM, c.hasSRID, c.srid)
if byteOrder := b.ByteOrder(); byteOrder != c.byteOrder {
t.Errorf("ByteOrder: expected %v, got %v\n", c.byteOrder, byteOrder)
}
if hasZ := b.HasZ(); hasZ != c.hasZ {
t.Errorf("HasZ: expected %v, got %v\n", c.hasZ, hasZ)
}
if hasM := b.HasM(); hasM != c.hasM {
t.Errorf("HasM: expected %v, got %v\n", c.hasM, hasM)
}
if hasSRID := b.HasSRID(); hasSRID != c.hasSRID {
t.Errorf("HasSRID: expected %v, got %v\n", c.hasSRID, hasSRID)
}
if srid := b.SRID(); srid != c.srid {
t.Errorf("SRID: expected %v, got %v\n", c.srid, srid)
}
})
}
}