diff options
Diffstat (limited to 'libgo/go/runtime/runtime_test.go')
-rw-r--r-- | libgo/go/runtime/runtime_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libgo/go/runtime/runtime_test.go b/libgo/go/runtime/runtime_test.go new file mode 100644 index 00000000000..d68b363e998 --- /dev/null +++ b/libgo/go/runtime/runtime_test.go @@ -0,0 +1,40 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime_test + +import ( + "io" + "testing" +) + +var errf error + +func errfn() error { + return errf +} + +func errfn1() error { + return io.EOF +} + +func BenchmarkIfaceCmp100(b *testing.B) { + for i := 0; i < b.N; i++ { + for j := 0; j < 100; j++ { + if errfn() == io.EOF { + b.Fatal("bad comparison") + } + } + } +} + +func BenchmarkIfaceCmpNil100(b *testing.B) { + for i := 0; i < b.N; i++ { + for j := 0; j < 100; j++ { + if errfn1() == nil { + b.Fatal("bad comparison") + } + } + } +} |