marking5/bf1c_test.scala
author Christian Urban <urbanc@in.tum.de>
Wed, 16 Jan 2019 12:20:34 +0000
changeset 253 ec7a12806c3f
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
253
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
import CW8b._
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
assert(start("[-]", Map(0 -> 100)) == Map(0 -> 0))
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
assert(start("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10))
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
assert(start("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42))
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
val hello = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
               +++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."""
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
assert(start(hello, Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87))
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
assert(start("+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]", Map()) == Map(0 -> 0, 1 -> 58, 2 -> 32))
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
val hello2 = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.!!!!!!!!!"""
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
assert(start(hello2, Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87))
ec7a12806c3f updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17