github.com/jackc/pgx/v5@v5.5.5/pgtype/box_test.go (about) 1 package pgtype_test 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/jackc/pgx/v5/pgtype" 8 "github.com/jackc/pgx/v5/pgxtest" 9 ) 10 11 func TestBoxCodec(t *testing.T) { 12 skipCockroachDB(t, "Server does not support box type") 13 14 pgxtest.RunValueRoundTripTests(context.Background(), t, defaultConnTestRunner, nil, "box", []pgxtest.ValueRoundTripTest{ 15 { 16 pgtype.Box{ 17 P: [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}}, 18 Valid: true, 19 }, 20 new(pgtype.Box), 21 isExpectedEq(pgtype.Box{ 22 P: [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}}, 23 Valid: true, 24 }), 25 }, 26 { 27 pgtype.Box{ 28 P: [2]pgtype.Vec2{{7.1, 5.2345678}, {-13.14, -5.234}}, 29 Valid: true, 30 }, 31 new(pgtype.Box), 32 isExpectedEq(pgtype.Box{ 33 P: [2]pgtype.Vec2{{7.1, 5.2345678}, {-13.14, -5.234}}, 34 Valid: true, 35 }), 36 }, 37 {pgtype.Box{}, new(pgtype.Box), isExpectedEq(pgtype.Box{})}, 38 {nil, new(pgtype.Box), isExpectedEq(pgtype.Box{})}, 39 }) 40 }