2
0

Convert box to Codec

This commit is contained in:
Jack Christensen
2022-01-03 20:27:35 -06:00
parent 4b1121c2a9
commit 298a5f0dca
4 changed files with 194 additions and 135 deletions
+23 -9
View File
@@ -7,17 +7,31 @@ import (
"github.com/jackc/pgx/v5/pgtype/testutil"
)
func TestBoxTranscode(t *testing.T) {
testutil.TestSuccessfulTranscode(t, "box", []interface{}{
&pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}},
Valid: true,
func TestBoxCodec(t *testing.T) {
testPgxCodec(t, "box", []PgxTranscodeTestCase{
{
pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}},
Valid: true,
},
new(pgtype.Box),
isExpectedEq(pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}},
Valid: true,
}),
},
&pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 1.678}, {-13.14, -5.234}},
Valid: true,
{
pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {-13.14, -5.234}},
Valid: true,
},
new(pgtype.Box),
isExpectedEq(pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.2345678}, {-13.14, -5.234}},
Valid: true,
}),
},
&pgtype.Box{},
{nil, new(pgtype.Box), isExpectedEq(pgtype.Box{})},
})
}