testing5/bf_test4.scala
changeset 340 9eeab89d0671
parent 329 8a34b2ebc8cc
equal deleted inserted replaced
339:16f437306f61 340:9eeab89d0671
     1 import CW10a._
     1 import CW10a._
     2 
     2 
     3 assert(run("[-]", Map(0 -> 100)) == Map(0 -> 0))
     3 assert(run("[-]", Map(0 -> 100)) == Map(0 -> 0))
     4 assert(run("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10))
     4 assert(run("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10))
     5 assert(run("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42))
     5 assert(run("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42))
     6 //val hw_urban = """+++++[->++++++++++<]>--<+++[->>++++++++++
     6 assert(run("++++++++++#>+***#") == Map(0 -> 10, 1 -> 1000))
     7 //                  <<]>>++<<----------[+>.>.<+<]"""
     7 assert(run("+++>+@+@+@+@+@") == Map(0 -> 3, 1 -> 7, 4 -> 3, 5 -> 3, 6 -> 3, 7 -> 3))
     8 //assert(run(hw_urban) == Map(0 -> 0, 1 -> 58, 2 -> 32))
       
     9 
     8 
       
     9 
       
    10 
       
    11 val hw_urban = """+++++[->++++++++++<]>--<+++[->>++++++++++
       
    12                   <<]>>++<<----------[+>.>.<+<]"""
       
    13 assert(run(hw_urban) == Map(0 -> 0, 1 -> 58, 2 -> 32))
       
    14