diff options
author | Ian Lance Taylor <iant@google.com> | 2011-01-21 18:19:03 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-01-21 18:19:03 +0000 |
commit | ff5f50c52c421d75940ef9392211e3ab24d71332 (patch) | |
tree | 27d8768fb1d25696d3c40b42535eb5e073c278da /libgo/go/testing | |
parent | d6ed1c8903e728f4233122554bab5910853338bd (diff) | |
download | gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.zip gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.tar.gz gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.tar.bz2 |
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.
From-SVN: r169098
Diffstat (limited to 'libgo/go/testing')
-rw-r--r-- | libgo/go/testing/benchmark.go | 6 | ||||
-rw-r--r-- | libgo/go/testing/quick/quick.go | 16 | ||||
-rw-r--r-- | libgo/go/testing/quick/quick_test.go | 7 | ||||
-rw-r--r-- | libgo/go/testing/testing.go | 2 |
4 files changed, 16 insertions, 15 deletions
diff --git a/libgo/go/testing/benchmark.go b/libgo/go/testing/benchmark.go index 7c30e4e..ad93802 100644 --- a/libgo/go/testing/benchmark.go +++ b/libgo/go/testing/benchmark.go @@ -175,7 +175,7 @@ func RunBenchmarks(matchString func(pat, str string) (bool, os.Error), benchmark for _, Benchmark := range benchmarks { matched, err := matchString(*matchBenchmarks, Benchmark.Name) if err != nil { - println("invalid regexp for -benchmarks:", err) + println("invalid regexp for -benchmarks:", err.String()) os.Exit(1) } if !matched { @@ -189,7 +189,7 @@ func RunBenchmarks(matchString func(pat, str string) (bool, os.Error), benchmark // Benchmark benchmarks a single function. Useful for creating // custom benchmarks that do not use gotest. -func Benchmark(name string, f func(b *B)) BenchmarkResult { - b := &B{benchmark: InternalBenchmark{name, f}} +func Benchmark(f func(b *B)) BenchmarkResult { + b := &B{benchmark: InternalBenchmark{"", f}} return b.run() } diff --git a/libgo/go/testing/quick/quick.go b/libgo/go/testing/quick/quick.go index 0b16597..a5568b0 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 } diff --git a/libgo/go/testing/quick/quick_test.go b/libgo/go/testing/quick/quick_test.go index c7bff96..b126e4a 100644 --- a/libgo/go/testing/quick/quick_test.go +++ b/libgo/go/testing/quick/quick_test.go @@ -17,7 +17,9 @@ func fFloat32(a float32) float32 { return a } func fFloat64(a float64) float64 { return a } -func fFloat(a float) float { return a } +func fComplex64(a complex64) complex64 { return a } + +func fComplex128(a complex128) complex128 { return a } func fInt16(a int16) int16 { return a } @@ -71,7 +73,8 @@ func TestCheckEqual(t *testing.T) { reportError("fBool", CheckEqual(fBool, fBool, nil), t) reportError("fFloat32", CheckEqual(fFloat32, fFloat32, nil), t) reportError("fFloat64", CheckEqual(fFloat64, fFloat64, nil), t) - reportError("fFloat", CheckEqual(fFloat, fFloat, nil), t) + reportError("fComplex64", CheckEqual(fComplex64, fComplex64, nil), t) + reportError("fComplex128", CheckEqual(fComplex128, fComplex128, nil), t) reportError("fInt16", CheckEqual(fInt16, fInt16, nil), t) reportError("fInt32", CheckEqual(fInt32, fInt32, nil), t) reportError("fInt64", CheckEqual(fInt64, fInt64, nil), t) diff --git a/libgo/go/testing/testing.go b/libgo/go/testing/testing.go index ae6d034..0e04935 100644 --- a/libgo/go/testing/testing.go +++ b/libgo/go/testing/testing.go @@ -144,7 +144,7 @@ func Main(matchString func(pat, str string) (bool, os.Error), tests []InternalTe for i := 0; i < len(tests); i++ { matched, err := matchString(*match, tests[i].Name) if err != nil { - println("invalid regexp for -match:", err) + println("invalid regexp for -match:", err.String()) os.Exit(1) } if !matched { |