1 |
1 |
2 import scala.concurrent._ |
2 //import scala.concurrent._ |
3 import scala.concurrent.duration._ |
3 //import scala.concurrent.duration._ |
4 import ExecutionContext.Implicits.global |
4 //import ExecutionContext.Implicits.global |
5 import scala.language.postfixOps |
5 //import scala.language.postfixOps |
6 import scala.language.reflectiveCalls |
6 //import scala.language.reflectiveCalls |
7 |
7 |
8 lazy val f = Future { |
8 //lazy val f = Future { |
9 import CW8b._ |
9 import CW8b._ |
10 |
10 |
11 assert(start("[-]", Map(0 -> 100)) == Map(0 -> 0)) |
11 assert(start("[-]", Map(0 -> 100)) == Map(0 -> 0)) |
12 assert(start("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)) |
12 assert(start("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)) |
13 assert(start("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)) |
13 assert(start("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)) |
14 assert(start("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<] |
14 assert(start("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<] |
15 <-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.""", Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87)) |
15 <-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.""", Map()) == Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87)) |
16 |
16 |
17 } |
17 //} |
18 |
18 |
19 Await.result(f, 120 second) |
19 //Await.result(f, 120 second) |