marking/re1d_test.scala
changeset 281 87b9e3e2c1a7
parent 280 a057dc4457fc
child 282 ec9773fe1dc0
equal deleted inserted replaced
280:a057dc4457fc 281:87b9e3e2c1a7
     1 
       
     2 import scala.concurrent._
       
     3 import scala.concurrent.duration._
       
     4 import ExecutionContext.Implicits.global
       
     5 import scala.language.postfixOps 
       
     6 
       
     7 
       
     8 val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
       
     9 
       
    10 lazy val f = Future {
       
    11   println("1")
       
    12   assert(ders(List.fill(5)('a'), EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
       
    13   println("2")
       
    14   assert(ders(List('b'), EVIL_urban) == ONE)
       
    15   println("3")
       
    16   assert(ders(List('b','b'), EVIL_urban) == ZERO)
       
    17   println("4")
       
    18   assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true)
       
    19   println("5")
       
    20   assert(matcher(EVIL_urban, "b") == true)
       
    21   println("6") 
       
    22   assert(matcher(EVIL_urban, "bb") == false)
       
    23   println("7")
       
    24   assert(matcher("abc", "abc") == true)
       
    25   println("8")
       
    26   assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
       
    27   println("9")
       
    28   assert(matcher(ONE, "") == true)
       
    29   println("10")
       
    30   assert(matcher(ZERO, "") == false)
       
    31   println("11")
       
    32   assert(matcher(ONE | CHAR('a'), "") == true)
       
    33   println("12")
       
    34   assert(matcher(ONE | CHAR('a'), "a") == true)
       
    35 }
       
    36 
       
    37 Await.result(f, 90 second)