diff options
Diffstat (limited to 'src/pkg/strconv/atof_test.go')
| -rw-r--r-- | src/pkg/strconv/atof_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pkg/strconv/atof_test.go b/src/pkg/strconv/atof_test.go index c0fe1bda7..30f1b05ba 100644 --- a/src/pkg/strconv/atof_test.go +++ b/src/pkg/strconv/atof_test.go @@ -114,6 +114,13 @@ func testAtof(t *testing.T, opt bool) { test.in, out, err, test.out, test.err) } + out, err = AtofN(test.in, 64) + outs = FtoaN(out, 'g', -1, 64) + if outs != test.out || !reflect.DeepEqual(err, test.err) { + t.Errorf("AtofN(%v, 64) = %v, %v want %v, %v\n", + test.in, out, err, test.out, test.err) + } + if float64(float32(out)) == out { out32, err := Atof32(test.in) outs := Ftoa32(out32, 'g', -1) @@ -121,6 +128,14 @@ func testAtof(t *testing.T, opt bool) { t.Errorf("Atof32(%v) = %v, %v want %v, %v # %v\n", test.in, out32, err, test.out, test.err, out) } + + out, err := AtofN(test.in, 32) + out32 = float32(out) + outs = FtoaN(float64(out32), 'g', -1, 32) + if outs != test.out || !reflect.DeepEqual(err, test.err) { + t.Errorf("AtofN(%v, 32) = %v, %v want %v, %v # %v\n", + test.in, out32, err, test.out, test.err, out) + } } if FloatSize == 64 || float64(float32(out)) == out { |
