marking/re1d_test.scala
changeset 92 cfff88de2ff5
child 93 21f41e08457d
equal deleted inserted replaced
91:b43c81c65341 92:cfff88de2ff5
       
     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 = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
       
     9 
       
    10 lazy val f = Future {
       
    11   assert(ders(List.fill(5)('a'), EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
       
    12   assert(ders(List('b'), EVIL) == ONE)
       
    13   assert(ders(List('b','b'), EVIL) == ZERO)
       
    14   assert(matcher(EVIL, "a" * 5 ++ "b") == true)
       
    15   assert(matcher(EVIL, "b") == true)
       
    16   assert(matcher(EVIL, "bb") == false)
       
    17   assert(matcher("abc", "abc") == true)
       
    18   assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
       
    19   assert(matcher(ONE, "") == true)
       
    20   assert(matcher(ZERO, "") == false)
       
    21   assert(matcher(ONE | CHAR('a'), "") == true)
       
    22   assert(matcher(ONE | CHAR('a'), "a") == true)
       
    23 }
       
    24 
       
    25 Await.result(f, 90 second)