pgx/box_test.go
Jack Christensen c16a4f7d6a Revert "Temporarily delete tests and pgxtype to break recursive dependency with pgx"
This reverts commit 32e20a603178b49fb189d1be971d0fb6960cabb2.
2021-07-24 10:40:30 -05:00

35 lines
740 B
Go

package pgtype_test
import (
"testing"
"github.com/jackc/pgtype"
"github.com/jackc/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}},
Status: pgtype.Present,
},
&pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 1.678}, {-13.14, -5.234}},
Status: pgtype.Present,
},
&pgtype.Box{Status: pgtype.Null},
})
}
func TestBoxNormalize(t *testing.T) {
testutil.TestSuccessfulNormalize(t, []testutil.NormalizeTest{
{
SQL: "select '3.14, 1.678, 7.1, 5.234'::box",
Value: &pgtype.Box{
P: [2]pgtype.Vec2{{7.1, 5.234}, {3.14, 1.678}},
Status: pgtype.Present,
},
},
})
}