Daily bump.
[official-gcc.git] / libgo / go / runtime / iface_test.go
blobbca0ea0ee758334082a13f3a4c2a942bda6b1297
1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package runtime_test
7 import (
8 "testing"
11 type I1 interface {
12 Method1()
15 type I2 interface {
16 Method1()
17 Method2()
20 type TS uint16
21 type TM uintptr
22 type TL [2]uintptr
24 func (TS) Method1() {}
25 func (TS) Method2() {}
26 func (TM) Method1() {}
27 func (TM) Method2() {}
28 func (TL) Method1() {}
29 func (TL) Method2() {}
31 var (
32 e interface{}
33 e_ interface{}
34 i1 I1
35 i2 I2
36 ts TS
37 tm TM
38 tl TL
41 func BenchmarkConvT2ESmall(b *testing.B) {
42 for i := 0; i < b.N; i++ {
43 e = ts
47 func BenchmarkConvT2EUintptr(b *testing.B) {
48 for i := 0; i < b.N; i++ {
49 e = tm
53 func BenchmarkConvT2ELarge(b *testing.B) {
54 for i := 0; i < b.N; i++ {
55 e = tl
59 func BenchmarkConvT2ISmall(b *testing.B) {
60 for i := 0; i < b.N; i++ {
61 i1 = ts
65 func BenchmarkConvT2IUintptr(b *testing.B) {
66 for i := 0; i < b.N; i++ {
67 i1 = tm
71 func BenchmarkConvT2ILarge(b *testing.B) {
72 for i := 0; i < b.N; i++ {
73 i1 = tl
77 func BenchmarkConvI2E(b *testing.B) {
78 i2 = tm
79 for i := 0; i < b.N; i++ {
80 e = i2
84 func BenchmarkConvI2I(b *testing.B) {
85 i2 = tm
86 for i := 0; i < b.N; i++ {
87 i1 = i2
91 func BenchmarkAssertE2T(b *testing.B) {
92 e = tm
93 for i := 0; i < b.N; i++ {
94 tm = e.(TM)
98 func BenchmarkAssertE2TLarge(b *testing.B) {
99 e = tl
100 for i := 0; i < b.N; i++ {
101 tl = e.(TL)
105 func BenchmarkAssertE2I(b *testing.B) {
106 e = tm
107 for i := 0; i < b.N; i++ {
108 i1 = e.(I1)
112 func BenchmarkAssertI2T(b *testing.B) {
113 i1 = tm
114 for i := 0; i < b.N; i++ {
115 tm = i1.(TM)
119 func BenchmarkAssertI2I(b *testing.B) {
120 i1 = tm
121 for i := 0; i < b.N; i++ {
122 i2 = i1.(I2)
126 func BenchmarkAssertI2E(b *testing.B) {
127 i1 = tm
128 for i := 0; i < b.N; i++ {
129 e = i1.(interface{})
133 func BenchmarkAssertE2E(b *testing.B) {
134 e = tm
135 for i := 0; i < b.N; i++ {
136 e_ = e