...
1 package pgtype_test
2
3 import (
4 "testing"
5
6 "github.com/jackc/pgtype"
7 "github.com/jackc/pgtype/testutil"
8 )
9
10 func TestBitTranscode(t *testing.T) {
11 testutil.TestSuccessfulTranscode(t, "bit(40)", []interface{}{
12 &pgtype.Varbit{Bytes: []byte{0, 0, 0, 0, 0}, Len: 40, Status: pgtype.Present},
13 &pgtype.Varbit{Bytes: []byte{0, 1, 128, 254, 255}, Len: 40, Status: pgtype.Present},
14 &pgtype.Varbit{Status: pgtype.Null},
15 })
16 }
17
18 func TestBitNormalize(t *testing.T) {
19 testutil.TestSuccessfulNormalize(t, []testutil.NormalizeTest{
20 {
21 SQL: "select B'111111111'",
22 Value: &pgtype.Bit{Bytes: []byte{255, 128}, Len: 9, Status: pgtype.Present},
23 },
24 })
25 }
26
View as plain text