...
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 TestVarbitTranscode(t *testing.T) {
11 testutil.TestSuccessfulTranscode(t, "varbit", []interface{}{
12 &pgtype.Varbit{Bytes: []byte{}, Len: 0, Status: pgtype.Present},
13 &pgtype.Varbit{Bytes: []byte{0, 1, 128, 254, 255}, Len: 40, Status: pgtype.Present},
14 &pgtype.Varbit{Bytes: []byte{0, 1, 128, 254, 128}, Len: 33, Status: pgtype.Present},
15 &pgtype.Varbit{Status: pgtype.Null},
16 })
17 }
18
19 func TestVarbitNormalize(t *testing.T) {
20 testutil.TestSuccessfulNormalize(t, []testutil.NormalizeTest{
21 {
22 SQL: "select B'111111111'",
23 Value: &pgtype.Varbit{Bytes: []byte{255, 128}, Len: 9, Status: pgtype.Present},
24 },
25 })
26 }
27
View as plain text