From decb75f242b2be04fc75f9adc8c2bd739856eb31 Mon Sep 17 00:00:00 2001 From: Jim Tsao Date: Sun, 31 Oct 2021 14:03:40 +0100 Subject: [PATCH] Add numeric tests for infinity encoding/decoding --- numeric_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/numeric_test.go b/numeric_test.go index ecd2d95e..455c3ac3 100644 --- a/numeric_test.go +++ b/numeric_test.go @@ -123,6 +123,8 @@ func TestNumericTranscode(t *testing.T) { testutil.TestSuccessfulTranscodeEqFunc(t, "numeric", []interface{}{ &pgtype.Numeric{NaN: true, Status: pgtype.Present}, + &pgtype.Numeric{InfinityModifier: pgtype.Infinity, Status: pgtype.Present}, + &pgtype.Numeric{InfinityModifier: pgtype.NegativeInfinity, Status: pgtype.Present}, &pgtype.Numeric{Int: big.NewInt(0), Exp: 0, Status: pgtype.Present}, &pgtype.Numeric{Int: big.NewInt(1), Exp: 0, Status: pgtype.Present}, @@ -372,6 +374,10 @@ func TestNumericEncodeDecodeBinary(t *testing.T) { 1.00002345, math.NaN(), float32(math.NaN()), + math.Inf(1), + float32(math.Inf(1)), + math.Inf(-1), + float32(math.Inf(-1)), } for i, tt := range tests {