main_marking5/bf_test3.scala
changeset 494 253d1ccb65de
parent 463 0315d9983cd0
equal deleted inserted replaced
493:244df77507c2 494:253d1ccb65de
     1 import M5a._
       
     2 
     1 
     3 import scala.concurrent._
     2 def urbanmain() = {
     4 import scala.concurrent.duration._
     3   import M5a._
     5 import ExecutionContext.Implicits.global
       
     6 import scala.language.postfixOps 
       
     7 
     4 
     8 lazy val f = Future {
     5   import scala.concurrent._
     9 assert(jumpRight("[xxxxxx]xxx", 1, 0) == 8)
     6   import scala.concurrent.duration._
    10 assert(jumpRight("[xx[x]x]xxx", 1, 0) == 8)
     7   import ExecutionContext.Implicits.global
    11 assert(jumpRight("[xx[x]x]xxx", 1, 0) == 8)  
     8   import scala.language.postfixOps 
    12 assert(jumpRight("[xx[xxx]xxx", 1, 0) == 11)
     9 
    13 assert(jumpRight("[x[][]x]xxx", 1, 0) == 8)
    10   lazy val f = Future {
    14 assert(jumpLeft("[xxxxxx]xxx", 6, 0) == 1)
    11     assert(jumpRight("[xxxxxx]xxx", 1, 0) == 8)
    15 assert(jumpLeft("[xxxxxx]xxx", 7, 0) == -1)
    12     assert(jumpRight("[xx[x]x]xxx", 1, 0) == 8)
    16 assert(jumpLeft("[x[][]x]xxx", 6, 0) == 1)
    13     assert(jumpRight("[xx[x]x]xxx", 1, 0) == 8)  
       
    14     assert(jumpRight("[xx[xxx]xxx", 1, 0) == 11)
       
    15     assert(jumpRight("[x[][]x]xxx", 1, 0) == 8)
       
    16     assert(jumpLeft("[xxxxxx]xxx", 6, 0) == 1)
       
    17     assert(jumpLeft("[xxxxxx]xxx", 7, 0) == -1)
       
    18     assert(jumpLeft("[x[][]x]xxx", 6, 0) == 1)
       
    19   }
       
    20 
       
    21   Await.result(f, 32 second)
    17 }
    22 }
    18 
       
    19 Await.result(f, 32 second)