From 376361f53ddd86ad4381ee4e5d5a802fa33c3de7 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 3 Oct 2020 08:36:40 -0500 Subject: [PATCH] Add tests for Int(2|4|8).Set accepting float(32|64) --- int2_test.go | 2 ++ int4_test.go | 2 ++ int8_test.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/int2_test.go b/int2_test.go index cf8acd30..178eb278 100644 --- a/int2_test.go +++ b/int2_test.go @@ -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}}, } diff --git a/int4_test.go b/int4_test.go index c679de74..ae01114f 100644 --- a/int4_test.go +++ b/int4_test.go @@ -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}}, } diff --git a/int8_test.go b/int8_test.go index fb6f581b..4e28e374 100644 --- a/int8_test.go +++ b/int8_test.go @@ -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}}, }