OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [initcomma.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $F.go && $L $F.$A && ./$A.out
2
 
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.
6
 
7
package main
8
 
9
var a = []int{1, 2}
10
var b = [5]int{1, 2, 3}
11
var c = []int{1}
12
var d = [...]int{1, 2, 3}
13
 
14
func main() {
15
        if len(a) != 2 {
16
                println("len a", len(a))
17
                panic("fail")
18
        }
19
        if len(b) != 5 {
20
                println("len b", len(b))
21
                panic("fail")
22
        }
23
        if len(c) != 1 {
24
                println("len d", len(c))
25
                panic("fail")
26
        }
27
        if len(d) != 3 {
28
                println("len c", len(d))
29
                panic("fail")
30
        }
31
 
32
        if a[0] != 1 {
33
                println("a[0]", a[0])
34
                panic("fail")
35
        }
36
        if a[1] != 2 {
37
                println("a[1]", a[1])
38
                panic("fail")
39
        }
40
 
41
        if b[0] != 1 {
42
                println("b[0]", b[0])
43
                panic("fail")
44
        }
45
        if b[1] != 2 {
46
                println("b[1]", b[1])
47
                panic("fail")
48
        }
49
        if b[2] != 3 {
50
                println("b[2]", b[2])
51
                panic("fail")
52
        }
53
        if b[3] != 0 {
54
                println("b[3]", b[3])
55
                panic("fail")
56
        }
57
        if b[4] != 0 {
58
                println("b[4]", b[4])
59
                panic("fail")
60
        }
61
 
62
        if c[0] != 1 {
63
                println("c[0]", c[0])
64
                panic("fail")
65
        }
66
 
67
        if d[0] != 1 {
68
                println("d[0]", d[0])
69
                panic("fail")
70
        }
71
        if d[1] != 2 {
72
                println("d[1]", d[1])
73
                panic("fail")
74
        }
75
        if d[2] != 3 {
76
                println("d[2]", d[2])
77
                panic("fail")
78
        }
79
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.