2
0

[]uint16, []uint32, and []uint64 encoding and decoding.

This commit is contained in:
m1kc (Max Musatov)
2016-03-17 10:30:30 +03:00
parent 34b1711eef
commit aac1fd86a4
2 changed files with 238 additions and 0 deletions
+40
View File
@@ -492,6 +492,22 @@ func TestArrayDecoding(t *testing.T) {
}
},
},
{
"select $1::smallint[]", []int16{2, 4, 484, 32767}, &[]int16{},
func(t *testing.T, query, scan interface{}) {
if reflect.DeepEqual(query, *(scan.(*[]int16))) == false {
t.Errorf("failed to encode smallint[]")
}
},
},
{
"select $1::smallint[]", []uint16{2, 4, 484, 32767}, &[]uint16{},
func(t *testing.T, query, scan interface{}) {
if reflect.DeepEqual(query, *(scan.(*[]uint16))) == false {
t.Errorf("failed to encode smallint[]")
}
},
},
{
"select $1::int[]", []int32{2, 4, 484}, &[]int32{},
func(t *testing.T, query, scan interface{}) {
@@ -500,6 +516,30 @@ func TestArrayDecoding(t *testing.T) {
}
},
},
{
"select $1::int[]", []uint32{2, 4, 484, 2147483647}, &[]uint32{},
func(t *testing.T, query, scan interface{}) {
if reflect.DeepEqual(query, *(scan.(*[]uint32))) == false {
t.Errorf("failed to encode int[]")
}
},
},
{
"select $1::bigint[]", []int64{2, 4, 484, 9223372036854775807}, &[]int64{},
func(t *testing.T, query, scan interface{}) {
if reflect.DeepEqual(query, *(scan.(*[]int64))) == false {
t.Errorf("failed to encode bigint[]")
}
},
},
{
"select $1::bigint[]", []uint64{2, 4, 484, 9223372036854775807}, &[]uint64{},
func(t *testing.T, query, scan interface{}) {
if reflect.DeepEqual(query, *(scan.(*[]uint64))) == false {
t.Errorf("failed to encode bigint[]")
}
},
},
{
"select $1::text[]", []string{"it's", "over", "9000!"}, &[]string{},
func(t *testing.T, query, scan interface{}) {