aboutsummaryrefslogtreecommitdiff
path: root/test/peano.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2012-01-18 14:31:31 -0800
committerIan Lance Taylor <iant@golang.org>2012-01-18 14:31:31 -0800
commitf2030938522fae7c6b65569a20a7b9ed1431b8f8 (patch)
treef3715df98cecac151807d23e7ec9403765252d5b /test/peano.go
parent39bb4bd454b915aed58d1732c6d7c6e3b233d706 (diff)
downloadgo-f2030938522fae7c6b65569a20a7b9ed1431b8f8.tar.gz
go-f2030938522fae7c6b65569a20a7b9ed1431b8f8.zip
test: change several tests to not print
This will make these tests more meaningful for gccgo, which runs tests in parallel and has no equivalent to golden.out. Remove ken/simpprint.go since it duplicates helloworld.go. R=golang-dev, r CC=golang-dev https://golang.org/cl/5536058
Diffstat (limited to 'test/peano.go')
-rw-r--r--test/peano.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/peano.go b/test/peano.go
index fb74e6533c..dd4c36e0b4 100644
--- a/test/peano.go
+++ b/test/peano.go
@@ -107,8 +107,16 @@ func init() {
// -------------------------------------
// Factorial
+var results = [...]int{
+ 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800,
+ 39916800, 479001600,
+}
+
func main() {
for i := 0; i <= 9; i++ {
- print(i, "! = ", count(fact(gen(i))), "\n")
+ if f := count(fact(gen(i))); f != results[i] {
+ println("FAIL:", i, "!:", f, "!=", results[i])
+ panic(0)
+ }
}
}