Commit 476e3cd7 authored by Ken Thompson's avatar Ken Thompson

fixed and added more tests

R=r
OCL=22187
CL=22187
parent 5bd3c3b7
...@@ -6,12 +6,29 @@ ...@@ -6,12 +6,29 @@
package main package main
var a = []int { 1, 2, } var a = []int { 1,2, }
var b = []int { } var b = [5]int { 1,2,3 }
var c = []int { 1 } var c = []int { 1 }
var d = [...]int { 1,2,3 }
func main() { func main() {
if len(a) != 2 { panicln("len a", len(a)) } if len(a) != 2 { panicln("len a", len(a)) }
if len(b) != 5 { panicln("len b", len(b)) } if len(b) != 5 { panicln("len b", len(b)) }
if len(c) != 1 { panicln("len a", len(c)) } if len(c) != 1 { panicln("len d", len(c)) }
if len(d) != 3 { panicln("len c", len(d)) }
if a[0] != 1 { panicln("a[0]", a[0]) }
if a[1] != 2 { panicln("a[1]", a[1]) }
if b[0] != 1 { panicln("b[0]", b[0]) }
if b[1] != 2 { panicln("b[1]", b[1]) }
if b[2] != 3 { panicln("b[2]", b[2]) }
if b[3] != 0 { panicln("b[3]", b[3]) }
if b[4] != 0 { panicln("b[4]", b[4]) }
if c[0] != 1 { panicln("c[0]", c[0]) }
if d[0] != 1 { panicln("d[0]", d[0]) }
if d[1] != 2 { panicln("d[1]", d[1]) }
if d[2] != 3 { panicln("d[2]", d[2]) }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment