mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.fuzz] internal/fuzz: allow float types to be integer literals
Previously, something like `float64(0)` would fail to decode since the 0 value is considered an integer literal, and the float64 parsing code required a float literal. Be more flexible here since an integer can always be converted to a float. Change-Id: Id1c53ef2e8a9748a4f71176b00b453a329af4ade Reviewed-on: https://go-review.googlesource.com/c/go/+/309032 Trust: Katie Hockman <katie@golang.org> Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
88c0c2d9ea
commit
8b96efd8a2
2 changed files with 11 additions and 4 deletions
|
|
@ -72,6 +72,13 @@ string("extra")
|
|||
},
|
||||
{
|
||||
in: `go test fuzz v1
|
||||
float64(0)
|
||||
float32(0)
|
||||
`,
|
||||
ok: true, // will be an integer literal since there is no decimal
|
||||
},
|
||||
{
|
||||
in: `go test fuzz v1
|
||||
int(-23)
|
||||
int8(-2)
|
||||
int64(2342425)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue