summaryrefslogtreecommitdiff
path: root/libgo/go/strconv/atoi_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/strconv/atoi_test.go')
-rw-r--r--libgo/go/strconv/atoi_test.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/libgo/go/strconv/atoi_test.go b/libgo/go/strconv/atoi_test.go
index 9ee11b71023..2d06efed0de 100644
--- a/libgo/go/strconv/atoi_test.go
+++ b/libgo/go/strconv/atoi_test.go
@@ -187,10 +187,10 @@ func init() {
}
}
-func TestAtoui64(t *testing.T) {
+func TestParseUint64(t *testing.T) {
for i := range atoui64tests {
test := &atoui64tests[i]
- out, err := Atoui64(test.in)
+ out, err := ParseUint(test.in, 10, 64)
if test.out != out || !reflect.DeepEqual(test.err, err) {
t.Errorf("Atoui64(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
@@ -198,21 +198,21 @@ func TestAtoui64(t *testing.T) {
}
}
-func TestBtoui64(t *testing.T) {
+func TestParseUint64Base(t *testing.T) {
for i := range btoui64tests {
test := &btoui64tests[i]
- out, err := Btoui64(test.in, 0)
+ out, err := ParseUint(test.in, 0, 64)
if test.out != out || !reflect.DeepEqual(test.err, err) {
- t.Errorf("Btoui64(%q) = %v, %v want %v, %v",
+ t.Errorf("ParseUint(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
}
}
}
-func TestAtoi64(t *testing.T) {
+func TestParseInt64(t *testing.T) {
for i := range atoi64tests {
test := &atoi64tests[i]
- out, err := Atoi64(test.in)
+ out, err := ParseInt(test.in, 10, 64)
if test.out != out || !reflect.DeepEqual(test.err, err) {
t.Errorf("Atoi64(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
@@ -220,23 +220,23 @@ func TestAtoi64(t *testing.T) {
}
}
-func TestBtoi64(t *testing.T) {
+func TestParseInt64Base(t *testing.T) {
for i := range btoi64tests {
test := &btoi64tests[i]
- out, err := Btoi64(test.in, 0)
+ out, err := ParseInt(test.in, 0, 64)
if test.out != out || !reflect.DeepEqual(test.err, err) {
- t.Errorf("Btoi64(%q) = %v, %v want %v, %v",
+ t.Errorf("ParseInt(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
}
}
}
-func TestAtoui(t *testing.T) {
+func TestParseUint(t *testing.T) {
switch IntSize {
case 32:
for i := range atoui32tests {
test := &atoui32tests[i]
- out, err := Atoui(test.in)
+ out, err := ParseUint(test.in, 10, 0)
if test.out != uint32(out) || !reflect.DeepEqual(test.err, err) {
t.Errorf("Atoui(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
@@ -245,7 +245,7 @@ func TestAtoui(t *testing.T) {
case 64:
for i := range atoui64tests {
test := &atoui64tests[i]
- out, err := Atoui(test.in)
+ out, err := ParseUint(test.in, 10, 0)
if test.out != uint64(out) || !reflect.DeepEqual(test.err, err) {
t.Errorf("Atoui(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
@@ -254,12 +254,12 @@ func TestAtoui(t *testing.T) {
}
}
-func TestAtoi(t *testing.T) {
+func TestParseInt(t *testing.T) {
switch IntSize {
case 32:
for i := range atoi32tests {
test := &atoi32tests[i]
- out, err := Atoi(test.in)
+ out, err := ParseInt(test.in, 10, 0)
if test.out != int32(out) || !reflect.DeepEqual(test.err, err) {
t.Errorf("Atoi(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
@@ -268,7 +268,7 @@ func TestAtoi(t *testing.T) {
case 64:
for i := range atoi64tests {
test := &atoi64tests[i]
- out, err := Atoi(test.in)
+ out, err := ParseInt(test.in, 10, 0)
if test.out != int64(out) || !reflect.DeepEqual(test.err, err) {
t.Errorf("Atoi(%q) = %v, %v want %v, %v",
test.in, out, err, test.out, test.err)
@@ -279,24 +279,24 @@ func TestAtoi(t *testing.T) {
func BenchmarkAtoi(b *testing.B) {
for i := 0; i < b.N; i++ {
- Atoi("12345678")
+ ParseInt("12345678", 10, 0)
}
}
func BenchmarkAtoiNeg(b *testing.B) {
for i := 0; i < b.N; i++ {
- Atoi("-12345678")
+ ParseInt("-12345678", 10, 0)
}
}
func BenchmarkAtoi64(b *testing.B) {
for i := 0; i < b.N; i++ {
- Atoi64("12345678901234")
+ ParseInt("12345678901234", 10, 64)
}
}
func BenchmarkAtoi64Neg(b *testing.B) {
for i := 0; i < b.N; i++ {
- Atoi64("-12345678901234")
+ ParseInt("-12345678901234", 10, 64)
}
}