1
0
mirror of https://github.com/golang/go synced 2024-11-22 02:44:39 -07:00

strconv: add test that trips up other implementations

R=r, gri1
CC=golang-dev
https://golang.org/cl/4092045
This commit is contained in:
Russ Cox 2011-02-01 12:48:18 -05:00
parent 59a47732dd
commit 850ad9a402
2 changed files with 11 additions and 0 deletions

View File

@ -103,6 +103,11 @@ var atoftests = []atofTest{
{"1e", "0", os.EINVAL}, {"1e", "0", os.EINVAL},
{"1e-", "0", os.EINVAL}, {"1e-", "0", os.EINVAL},
{".e-1", "0", os.EINVAL}, {".e-1", "0", os.EINVAL},
// http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
{"2.2250738585072012e-308", "2.2250738585072014e-308", nil},
// http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
{"2.2250738585072011e-308", "2.225073858507201e-308", nil},
} }
func init() { func init() {

View File

@ -118,6 +118,12 @@ var ftoatests = []ftoaTest{
{0.5, 'f', 1, "0.5"}, {0.5, 'f', 1, "0.5"},
{0.5, 'f', 0, "0"}, {0.5, 'f', 0, "0"},
{1.5, 'f', 0, "2"}, {1.5, 'f', 0, "2"},
// http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
{2.2250738585072012e-308, 'g', -1, "2.2250738585072014e-308"},
// TODO: uncomment after fixing issue 1463.
// http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
// {2.2250738585072011e-308, 'g', -1, "2.225073858507201e-308"},
} }
func TestFtoa(t *testing.T) { func TestFtoa(t *testing.T) {