From b6d1e37ade9564d2579f54077996ddd8d2dc48ad Mon Sep 17 00:00:00 2001 From: Nathan <148575555+nathan-artie@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:24:32 -0700 Subject: [PATCH] Tests --- lib/typing/numeric_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/typing/numeric_test.go b/lib/typing/numeric_test.go index a20600532..01204b033 100644 --- a/lib/typing/numeric_test.go +++ b/lib/typing/numeric_test.go @@ -1,6 +1,8 @@ package typing import ( + "fmt" + "math" "testing" "github.com/artie-labs/transfer/lib/ptr" @@ -67,6 +69,12 @@ func TestParseNumeric(t *testing.T) { expectedPrecision: ptr.ToInt32(5), expectedScale: 0, }, + { + parameters: []string{fmt.Sprint(math.MaxInt32), fmt.Sprint(math.MaxInt32)}, + expectedKindDetails: EDecimal, + expectedPrecision: ptr.ToInt32(math.MaxInt32), + expectedScale: math.MaxInt32, + }, } for _, testCase := range testCases { @@ -80,4 +88,8 @@ func TestParseNumeric(t *testing.T) { } } } + + // Test values that are larger than [math.MaxInt32] + assert.Equal(t, "invalid", ParseNumeric([]string{"10", fmt.Sprint(math.MaxInt32 + 1)}).Kind) + assert.Equal(t, "invalid", ParseNumeric([]string{fmt.Sprint(math.MaxInt32 + 1), "10"}).Kind) }