2
0

Import Fix for -0 numeric

From pgx: d678216f46
This commit is contained in:
Jack Christensen
2019-06-08 11:45:47 -05:00
parent 3294a8cf1f
commit 4e0ed911f5
3 changed files with 19 additions and 1 deletions
+3
View File
@@ -1,6 +1,7 @@
package pgtype_test
import (
"math"
"math/big"
"math/rand"
"reflect"
@@ -188,7 +189,9 @@ func TestNumericSet(t *testing.T) {
result *pgtype.Numeric
}{
{source: float32(1), result: &pgtype.Numeric{Int: big.NewInt(1), Status: pgtype.Present}},
{source: float32(math.Copysign(0, -1)), result: &pgtype.Numeric{Int: big.NewInt(0), Status: pgtype.Present}},
{source: float64(1), result: &pgtype.Numeric{Int: big.NewInt(1), Status: pgtype.Present}},
{source: float64(math.Copysign(0, -1)), result: &pgtype.Numeric{Int: big.NewInt(0), Status: pgtype.Present}},
{source: int8(1), result: &pgtype.Numeric{Int: big.NewInt(1), Status: pgtype.Present}},
{source: int16(1), result: &pgtype.Numeric{Int: big.NewInt(1), Status: pgtype.Present}},
{source: int32(1), result: &pgtype.Numeric{Int: big.NewInt(1), Status: pgtype.Present}},