-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbox_test.go
More file actions
40 lines (36 loc) · 1 KB
/
Copy pathbox_test.go
File metadata and controls
40 lines (36 loc) · 1 KB
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
package pgtype_test
import (
"context"
"testing"
"github.com/jackc/pgx/v5/pgtype"
"github.com/jackc/pgx/v5/pgxtest"
)
func TestBoxCodec(t *testing.T) {
skipCockroachDB(t, "Server does not support box type")
pgxtest.RunValueRoundTripTests(context.Background(), t, defaultConnTestRunner, nil, "box", []pgxtest.ValueRoundTripTest{
{
Param: pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}},
Valid: true,
},
Result: new(pgtype.Box),
Test: isExpectedEq(pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}},
Valid: true,
}),
},
{
Param: pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {-13.14, -5.234}},
Valid: true,
},
Result: new(pgtype.Box),
Test: isExpectedEq(pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {-13.14, -5.234}},
Valid: true,
}),
},
{Param: pgtype.Box{}, Result: new(pgtype.Box), Test: isExpectedEq(pgtype.Box{})},
{Param: nil, Result: new(pgtype.Box), Test: isExpectedEq(pgtype.Box{})},
})
}