1
0
mirror of https://github.com/golang/go synced 2024-11-12 03:10:22 -07:00
go/test/ken/simparray.go
Rob Pike ab34d15f69 add ken's tests.
update run to work with multiple directories

SVN=121485
2008-06-06 14:27:34 -07:00

50 lines
694 B
Go

// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
var b[10] float;
func
main()
{
var a[10] float;
for i:=short(5); i<10; i=i+1 {
a[i] = float(i);
}
s := float(0);
for i:=5; i<10; i=i+1 {
s = s + a[i];
}
if s != 35 { panic s; }
for i:=short(5); i<10; i=i+1 {
b[i] = float(i);
}
s := float(0);
for i:=5; i<10; i=i+1 {
s = s + b[i];
}
if s != 35 { panic s; }
b := new([100]int);
for i:=0; i<100; i=i+1 {
b[i] = i;
}
s := 0;
for i:=0; i<100; i=i+1 {
s = s+b[i];
}
if s != 4950 { panic s; }
}