marking3/bf1c_test.scala
author Christian Urban <urbanc@in.tum.de>
Sat, 16 Jun 2018 20:55:51 +0100
changeset 185 5ab45f3fee1c
parent 170 37b1bfcdba79
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
168
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
import CW8b._
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
assert(start("[-]", Map(0 -> 100)) == Map(0 -> 0))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
assert(start("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
assert(start("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42))
170
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
     7
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
     8
val hello = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
     9
               +++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."""
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
    10
assert(start(hello, Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87))
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
    11
168
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
assert(start("+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]", Map()) == Map(0 -> 0, 1 -> 58, 2 -> 32))
170
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
    13
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
    14
val hello2 = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.!!!!!!!!!"""
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
    15
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
    16
assert(start(hello2, Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87))
37b1bfcdba79 updated
Christian Urban <urbanc@in.tum.de>
parents: 168
diff changeset
    17