2
0

Convert circle to Codec

This commit is contained in:
Jack Christensen
2022-01-03 20:53:50 -06:00
parent 5c4560eed3
commit eb2c37a983
4 changed files with 177 additions and 126 deletions
+12 -5
View File
@@ -4,13 +4,20 @@ import (
"testing"
"github.com/jackc/pgx/v5/pgtype"
"github.com/jackc/pgx/v5/pgtype/testutil"
)
func TestCircleTranscode(t *testing.T) {
testutil.TestSuccessfulTranscode(t, "circle", []interface{}{
&pgtype.Circle{P: pgtype.Vec2{1.234, 5.67890123}, R: 3.5, Valid: true},
&pgtype.Circle{P: pgtype.Vec2{-1.234, -5.6789}, R: 12.9, Valid: true},
&pgtype.Circle{},
testPgxCodec(t, "circle", []PgxTranscodeTestCase{
{
pgtype.Circle{P: pgtype.Vec2{1.234, 5.67890123}, R: 3.5, Valid: true},
new(pgtype.Circle),
isExpectedEq(pgtype.Circle{P: pgtype.Vec2{1.234, 5.67890123}, R: 3.5, Valid: true}),
},
{
pgtype.Circle{P: pgtype.Vec2{1.234, 5.67890123}, R: 3.5, Valid: true},
new(pgtype.Circle),
isExpectedEq(pgtype.Circle{P: pgtype.Vec2{1.234, 5.67890123}, R: 3.5, Valid: true}),
},
{nil, new(pgtype.Circle), isExpectedEq(pgtype.Circle{})},
})
}