Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie committed Jun 26, 2024
1 parent 91ca47b commit b6d1e37
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/typing/numeric_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package typing

import (
"fmt"
"math"
"testing"

"github.com/artie-labs/transfer/lib/ptr"
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
}

0 comments on commit b6d1e37

Please sign in to comment.