1
0
mirror of https://github.com/golang/go synced 2024-11-12 04:30:22 -07:00
go/test/ken/robiota.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

31 lines
558 B
Go

// 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.
// $G $D/$F.go && $L $F.$A && ./$A.out
package main
func assert(cond bool, msg string) {
if !cond {
print "assertion fail: " + msg + "\n";
panic 1;
}
}
const (
x int = iota;
y = iota;
z = 1 << iota;
f float = 2 * iota;
g float = 4.5 * float(iota);
);
func main() {
assert(x == 0, "x");
assert(y == 1, "y");
assert(z == 4, "z");
assert(f == 6.0, "f");
assert(g == 18.0, "g");
}