marking4/bf1c_test.scala
changeset 227 b5f3e814a710
parent 170 37b1bfcdba79
equal deleted inserted replaced
226:5e489c9fe47b 227:b5f3e814a710
       
     1 
       
     2 import CW8b._
       
     3 
       
     4 assert(start("[-]", Map(0 -> 100)) == Map(0 -> 0))
       
     5 assert(start("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10))
       
     6 assert(start("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42))
       
     7 
       
     8 val hello = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.
       
     9                +++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."""
       
    10 assert(start(hello, Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87))
       
    11 
       
    12 assert(start("+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]", Map()) == Map(0 -> 0, 1 -> 58, 2 -> 32))
       
    13 
       
    14 val hello2 = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.!!!!!!!!!"""
       
    15 
       
    16 assert(start(hello2, Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87))
       
    17