Add tests for Int(2|4|8).Set accepting float(32|64)

non-blocking
Jack Christensen 2020-10-03 08:36:40 -05:00
parent 909d814f65
commit 376361f53d
3 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,8 @@ func TestInt2Set(t *testing.T) {
{source: uint16(1), result: pgtype.Int2{Int: 1, Status: pgtype.Present}},
{source: uint32(1), result: pgtype.Int2{Int: 1, Status: pgtype.Present}},
{source: uint64(1), result: pgtype.Int2{Int: 1, Status: pgtype.Present}},
{source: float32(1), result: pgtype.Int2{Int: 1, Status: pgtype.Present}},
{source: float64(1), result: pgtype.Int2{Int: 1, Status: pgtype.Present}},
{source: "1", result: pgtype.Int2{Int: 1, Status: pgtype.Present}},
{source: _int8(1), result: pgtype.Int2{Int: 1, Status: pgtype.Present}},
}

View File

@ -37,6 +37,8 @@ func TestInt4Set(t *testing.T) {
{source: uint16(1), result: pgtype.Int4{Int: 1, Status: pgtype.Present}},
{source: uint32(1), result: pgtype.Int4{Int: 1, Status: pgtype.Present}},
{source: uint64(1), result: pgtype.Int4{Int: 1, Status: pgtype.Present}},
{source: float32(1), result: pgtype.Int4{Int: 1, Status: pgtype.Present}},
{source: float64(1), result: pgtype.Int4{Int: 1, Status: pgtype.Present}},
{source: "1", result: pgtype.Int4{Int: 1, Status: pgtype.Present}},
{source: _int8(1), result: pgtype.Int4{Int: 1, Status: pgtype.Present}},
}

View File

@ -37,6 +37,8 @@ func TestInt8Set(t *testing.T) {
{source: uint16(1), result: pgtype.Int8{Int: 1, Status: pgtype.Present}},
{source: uint32(1), result: pgtype.Int8{Int: 1, Status: pgtype.Present}},
{source: uint64(1), result: pgtype.Int8{Int: 1, Status: pgtype.Present}},
{source: float32(1), result: pgtype.Int8{Int: 1, Status: pgtype.Present}},
{source: float64(1), result: pgtype.Int8{Int: 1, Status: pgtype.Present}},
{source: "1", result: pgtype.Int8{Int: 1, Status: pgtype.Present}},
{source: _int8(1), result: pgtype.Int8{Int: 1, Status: pgtype.Present}},
}