~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to test/interface/fake.go

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý
  • Date: 2011-11-28 08:46:18 UTC
  • mfrom: (14.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20111128084618-pjgrpnkufjzxxjue
Tags: 1:60.3-1
Imported Upstream version 60.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import "reflect"
13
13
 
14
14
type T struct {
15
 
        f float32
16
 
        g float32
17
 
 
18
 
        s string
19
 
        t string
20
 
 
21
 
        u uint32
22
 
        v uint32
23
 
 
24
 
        w uint32
25
 
        x uint32
26
 
 
27
 
        y uint32
28
 
        z uint32
 
15
        F float32
 
16
        G float32
 
17
 
 
18
        S string
 
19
        T string
 
20
 
 
21
        U uint32
 
22
        V uint32
 
23
 
 
24
        W uint32
 
25
        X uint32
 
26
 
 
27
        Y uint32
 
28
        Z uint32
29
29
}
30
30
 
31
31
func add(s, t string) string {
40
40
 
41
41
func main() {
42
42
        var x T
43
 
        x.f = 1.0
44
 
        x.g = x.f
45
 
        x.s = add("abc", "def")
46
 
        x.t = add("abc", "def")
47
 
        x.u = 1
48
 
        x.v = 2
49
 
        x.w = 1 << 28
50
 
        x.x = 2 << 28
51
 
        x.y = 0x12345678
52
 
        x.z = x.y
 
43
        x.F = 1.0
 
44
        x.G = x.F
 
45
        x.S = add("abc", "def")
 
46
        x.T = add("abc", "def")
 
47
        x.U = 1
 
48
        x.V = 2
 
49
        x.W = 1 << 28
 
50
        x.X = 2 << 28
 
51
        x.Y = 0x12345678
 
52
        x.Z = x.Y
53
53
 
54
54
        // check mem and string
55
55
        v := reflect.ValueOf(x)