72 | 72 |
|
73 | 73 |
func TestConvertInt8(t *testing.T) {
|
74 | 74 |
validInts := []int8{0, 1, -1, math.MaxInt8, math.MinInt8}
|
75 | |
invalidInts := []string{"1.233", "a", "false", strconv.Itoa(int(math.MaxInt64))}
|
|
75 |
invalidInts := []string{"1.233", "a", "false", strconv.FormatInt(int64(math.MaxInt64), 10)}
|
76 | 76 |
|
77 | 77 |
for _, f := range validInts {
|
78 | 78 |
c, err := ConvertInt8(FormatInt8(f))
|
|
88 | 88 |
|
89 | 89 |
func TestConvertInt16(t *testing.T) {
|
90 | 90 |
validInts := []int16{0, 1, -1, math.MaxInt8, math.MinInt8, math.MaxInt16, math.MinInt16}
|
91 | |
invalidInts := []string{"1.233", "a", "false", strconv.Itoa(int(math.MaxInt64))}
|
|
91 |
invalidInts := []string{"1.233", "a", "false", strconv.FormatInt(int64(math.MaxInt64), 10)}
|
92 | 92 |
|
93 | 93 |
for _, f := range validInts {
|
94 | 94 |
c, err := ConvertInt16(FormatInt16(f))
|
|
104 | 104 |
|
105 | 105 |
func TestConvertInt32(t *testing.T) {
|
106 | 106 |
validInts := []int32{0, 1, -1, math.MaxInt8, math.MinInt8, math.MaxInt16, math.MinInt16, math.MinInt32, math.MaxInt32}
|
107 | |
invalidInts := []string{"1.233", "a", "false", strconv.Itoa(int(math.MaxInt64))}
|
|
107 |
invalidInts := []string{"1.233", "a", "false", strconv.FormatInt(int64(math.MaxInt64), 10)}
|
108 | 108 |
|
109 | 109 |
for _, f := range validInts {
|
110 | 110 |
c, err := ConvertInt32(FormatInt32(f))
|