Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Implement fuzzing of complex types #37

Merged
merged 1 commit into from
Feb 3, 2020
Merged

Conversation

punkeel
Copy link
Contributor

@punkeel punkeel commented Feb 2, 2020

From builtin.go:
The complex built-in function constructs a complex value from two floating-point
values. The real and imaginary parts must be of the same size, either float32 or
float64 (or assignable to them), and the return value will be the corresponding
complex type (complex64 for float32, complex128 for float64).

From builtin.go:
The complex built-in function constructs a complex value from two floating-point
values. The real and imaginary parts must be of the same size, either float32 or
float64 (or assignable to them), and the return value will be the corresponding
complex type (complex64 for float32, complex128 for float64).
@@ -450,10 +450,10 @@ var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
v.SetFloat(r.Float64())
},
reflect.Complex64: func(v reflect.Value, r *rand.Rand) {
panic("unimplemented")
v.SetComplex(complex128(complex(r.Float32(), r.Float32())))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to look it up for myself, but the "extra" cast you have here is 100% necessary, so... ✔️

@lavalamp
Copy link
Contributor

lavalamp commented Feb 3, 2020

LGTM, thanks

@lavalamp lavalamp merged commit 2257016 into google:master Feb 3, 2020
@punkeel
Copy link
Contributor Author

punkeel commented Feb 3, 2020

Thanks!

@punkeel punkeel deleted the fuzz-complex branch February 3, 2020 23:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants