2
0
Files
pgx/pgtype/bit_test.go
T
Jack Christensen 7e13db4538 Finish import of pgtype repo
Fix some tests that broke by merging repos
Tweak readme wording
2021-12-04 13:45:57 -06:00

26 lines
614 B
Go

package pgtype_test
import (
"testing"
"github.com/jackc/pgx/v4/pgtype"
"github.com/jackc/pgx/v4/pgtype/testutil"
)
func TestBitTranscode(t *testing.T) {
testutil.TestSuccessfulTranscode(t, "bit(40)", []interface{}{
&pgtype.Varbit{Bytes: []byte{0, 0, 0, 0, 0}, Len: 40, Valid: true},
&pgtype.Varbit{Bytes: []byte{0, 1, 128, 254, 255}, Len: 40, Valid: true},
&pgtype.Varbit{},
})
}
func TestBitNormalize(t *testing.T) {
testutil.TestSuccessfulNormalize(t, []testutil.NormalizeTest{
{
SQL: "select B'111111111'",
Value: &pgtype.Bit{Bytes: []byte{255, 128}, Len: 9, Valid: true},
},
})
}