marking5/bf_test6.scala
changeset 255 44f2b6e34015
child 286 5c57c407e27b
equal deleted inserted replaced
254:cc0154804096 255:44f2b6e34015
       
     1 
       
     2 assert(optimise(load_bff("benchmark.bf")).length == 181)
       
     3 assert(optimise(load_bff("mandelbrot.bf")).length == 11203)
       
     4 
       
     5 
       
     6 
       
     7 assert(run3("[-]", Map(0 -> 100)) == Map(0 -> 0))
       
     8 assert(run3("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10))
       
     9 assert(run3("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42))
       
    10 val hw_urban2 = """+++++[->++++++++++<]>--<+++[->>++++++++++
       
    11                   <<]>>++<<----------[+>.>.<+<]"""
       
    12 assert(run3(hw_urban2) == Map(0 -> 0, 1 -> 58, 2 -> 32))
       
    13 
       
    14 val hw_urban3 = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.
       
    15                    +++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."""
       
    16 
       
    17 assert(run3(hw_urban3) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87))