diff options
author | Ian Lance Taylor <iant@golang.org> | 2012-01-18 13:20:55 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2012-01-18 13:20:55 -0800 |
commit | 6b3462820f5a1c97adfa148df0e1e37c37a3716c (patch) | |
tree | 0b7349ea2c99eedd93db2ff7ebd589489da88ad0 /test/turing.go | |
parent | 20812c490736e18c454c807ed1c65304bd8b7e5d (diff) | |
download | go-6b3462820f5a1c97adfa148df0e1e37c37a3716c.tar.gz go-6b3462820f5a1c97adfa148df0e1e37c37a3716c.zip |
test: gofmt a few tests
I'm planning to change these tests, but the gofmt changes are
fairly extensive, so I'm separating the gofmt changes from the
substantive changes.
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5557052
Diffstat (limited to 'test/turing.go')
-rw-r--r-- | test/turing.go | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/test/turing.go b/test/turing.go index 0af39de8b2..9d3f3a669d 100644 --- a/test/turing.go +++ b/test/turing.go @@ -10,15 +10,16 @@ package main var p, pc int var a [30000]byte + const prog = "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.!" func scan(dir int) { for nest := dir; dir*nest > 0; pc += dir { switch prog[pc+dir] { - case ']': - nest-- - case '[': - nest++ + case ']': + nest-- + case '[': + nest++ } } } @@ -26,26 +27,26 @@ func scan(dir int) { func main() { for { switch prog[pc] { - case '>': - p++ - case '<': - p-- - case '+': - a[p]++ - case '-': - a[p]-- - case '.': - print(string(a[p])) - case '[': - if a[p] == 0 { - scan(1) - } - case ']': - if a[p] != 0 { - scan(-1) - } - default: - return + case '>': + p++ + case '<': + p-- + case '+': + a[p]++ + case '-': + a[p]-- + case '.': + print(string(a[p])) + case '[': + if a[p] == 0 { + scan(1) + } + case ']': + if a[p] != 0 { + scan(-1) + } + default: + return } pc++ } |