diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-21 18:19:03 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-21 18:19:03 +0000 |
commit | 48080209fa53b6ea88c86e9f445c431b4cd1e47b (patch) | |
tree | 27d8768fb1d25696d3c40b42535eb5e073c278da /libgo/go/testing/quick/quick.go | |
parent | bff898fbbe4358a4b7e337852df4d6043e0bd3f5 (diff) | |
download | ppe42-gcc-48080209fa53b6ea88c86e9f445c431b4cd1e47b.tar.gz ppe42-gcc-48080209fa53b6ea88c86e9f445c431b4cd1e47b.zip |
Remove the types float and complex.
Update to current version of Go library.
Update testsuite for removed types.
* go-lang.c (go_langhook_init): Omit float_type_size when calling
go_create_gogo.
* go-c.h: Update declaration of go_create_gogo.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/testing/quick/quick.go')
-rw-r--r-- | libgo/go/testing/quick/quick.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libgo/go/testing/quick/quick.go b/libgo/go/testing/quick/quick.go index 0b1659725bd..a5568b04830 100644 --- a/libgo/go/testing/quick/quick.go +++ b/libgo/go/testing/quick/quick.go @@ -60,18 +60,16 @@ func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) { switch concrete := t.(type) { case *reflect.BoolType: return reflect.NewValue(rand.Int()&1 == 0), true - case *reflect.FloatType, *reflect.IntType, *reflect.UintType: + case *reflect.FloatType, *reflect.IntType, *reflect.UintType, *reflect.ComplexType: switch t.Kind() { case reflect.Float32: return reflect.NewValue(randFloat32(rand)), true case reflect.Float64: return reflect.NewValue(randFloat64(rand)), true - case reflect.Float: - if t.Size() == 4 { - return reflect.NewValue(float(randFloat32(rand))), true - } else { - return reflect.NewValue(float(randFloat64(rand))), true - } + case reflect.Complex64: + return reflect.NewValue(complex(randFloat32(rand), randFloat32(rand))), true + case reflect.Complex128: + return reflect.NewValue(complex(randFloat64(rand), randFloat64(rand))), true case reflect.Int16: return reflect.NewValue(int16(randInt64(rand))), true case reflect.Int32: @@ -157,7 +155,7 @@ type Config struct { MaxCount int // MaxCountScale is a non-negative scale factor applied to the default // maximum. If zero, the default is unchanged. - MaxCountScale float + MaxCountScale float64 // If non-nil, rand is a source of random numbers. Otherwise a default // pseudo-random source will be used. Rand *rand.Rand @@ -183,7 +181,7 @@ func (c *Config) getMaxCount() (maxCount int) { maxCount = c.MaxCount if maxCount == 0 { if c.MaxCountScale != 0 { - maxCount = int(c.MaxCountScale * float(*defaultMaxCount)) + maxCount = int(c.MaxCountScale * float64(*defaultMaxCount)) } else { maxCount = *defaultMaxCount } |