Add a few tests

pull/1281/head
Jack Christensen 2022-06-20 20:43:56 -05:00
parent e12ba1b6b9
commit c0a4d1b9ce
1 changed files with 4 additions and 0 deletions

View File

@ -113,6 +113,10 @@ func TestNumericCodec(t *testing.T) {
{"1.23", new(string), isExpectedEq("1.23")},
{pgtype.Numeric{}, new(pgtype.Numeric), isExpectedEq(pgtype.Numeric{})},
{nil, new(pgtype.Numeric), isExpectedEq(pgtype.Numeric{})},
{mustParseNumeric(t, "1"), new(string), isExpectedEq("1")},
{pgtype.Numeric{NaN: true, Valid: true}, new(string), isExpectedEq("NaN")},
{pgtype.Numeric{InfinityModifier: pgtype.Infinity, Valid: true}, new(string), isExpectedEq("Infinity")},
{pgtype.Numeric{InfinityModifier: pgtype.NegativeInfinity, Valid: true}, new(string), isExpectedEq("-Infinity")},
})
pgxtest.RunValueRoundTripTests(context.Background(), t, defaultConnTestRunner, nil, "int8", []pgxtest.ValueRoundTripTest{