1 // $G $F.go && $L $F.$A && ./$A.out
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
9 type T struct { i int; f float; s string; next *T }
11 type R struct { num int }
20 for i := 0; i < len(a); i++ {
21 if a[i].num != i { panic("bad") }
25 type P struct { a, b int };
26 func NewP(a, b int) *P {
32 t = T(0, 7.2, "hi", &t);
35 tp = &T(0, 7.2, "hi", &t);
38 if len(a1) != 3 { panic("a1") }
40 if len(a2) != 10 || cap(a2) != 10 { panic("a2") }
42 a3 := [10]int(1,2,3,);
43 if len(a3) != 10 || a2[3] != 0 { panic("a3") }
47 if len(oai) != 3 { panic("oai") }
49 at := [...]*T(&t, &t, &t);
50 if len(at) != 3 { panic("at") }
53 ac := []chan int(c, c, c);
54 if len(ac) != 3 { panic("ac") }
56 aat := [][len(at)]*T(at, at);
57 if len(aat) != 2 || len(aat[1]) != 3 { panic("aat") }
59 s := string([]byte('h', 'e', 'l', 'l', 'o'));
60 if s != "hello" { panic("s") }
62 m := map[string]float("one":1.0, "two":2.0, "pi":22./7.);
63 if len(m) != 3 { panic("m") }
65 eq([]*R(itor(0), itor(1), itor(2), itor(3), itor(4), itor(5)));
69 if p1 == p2 { panic("NewP") }