main_marking5/bf_test3.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 26 Apr 2024 17:37:56 +0100
changeset 488 5deaf53c2faa
parent 463 0315d9983cd0
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
424
Christian Urban <christian.urban@kcl.ac.uk>
parents: 392
diff changeset
     1
import M5a._
392
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
463
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
     3
import scala.concurrent._
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
     4
import scala.concurrent.duration._
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
     5
import ExecutionContext.Implicits.global
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
     6
import scala.language.postfixOps 
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
     7
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
     8
lazy val f = Future {
392
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
assert(jumpRight("[xxxxxx]xxx", 1, 0) == 8)
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
assert(jumpRight("[xx[x]x]xxx", 1, 0) == 8)
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
assert(jumpRight("[xx[x]x]xxx", 1, 0) == 8)  
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
assert(jumpRight("[xx[xxx]xxx", 1, 0) == 11)
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
assert(jumpRight("[x[][]x]xxx", 1, 0) == 8)
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
assert(jumpLeft("[xxxxxx]xxx", 6, 0) == 1)
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
assert(jumpLeft("[xxxxxx]xxx", 7, 0) == -1)
97ecdc8cb61b marking 5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
assert(jumpLeft("[x[][]x]xxx", 6, 0) == 1)
463
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    17
}
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    18
0315d9983cd0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    19
Await.result(f, 32 second)