Add test case for "70000000000000000" and fix
This commit is contained in:
parent
1415b3ea84
commit
1abb8f7e73
@ -45,7 +45,7 @@ func convertNumStringBase(in string, base int64) (int64, error) {
|
||||
}
|
||||
n += a
|
||||
|
||||
if n < 0 {
|
||||
if n <= 0 && in[0] != '0' {
|
||||
return 0, errors.New("range")
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ var testCases = []struct {
|
||||
{"2cg134", 0, "syntax"},
|
||||
{"8000000000000000", 0, "range"},
|
||||
{"9223372036854775809", 0, "range"},
|
||||
{"70000000000000000", 0, "range"},
|
||||
}
|
||||
|
||||
func TestParseHex(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user