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) }