testing3/re1c_test.scala
changeset 160 863feeb5c760
parent 153 4383809c176a
equal deleted inserted replaced
159:92c31cbb1952 160:863feeb5c760
     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 
     8 
     9 lazy val f = Future {
     9 //lazy val f = Future {
    10   import CW8a._
    10   import CW8a._
    11 
    11 
    12   assert(simp(ZERO | ONE) == ONE)
    12   assert(simp(ZERO | ONE) == ONE)
    13   assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
    13   assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
    14   assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
    14   assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
    15   assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
    15   assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
    16   assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
    16   assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
    17   assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
    17   assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
    18   assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
    18   assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
    19 }
    19   assert(simp(ALT((CHAR('a') | ZERO) ~ ONE,
       
    20                   ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
    20 
    21 
    21 Await.result(f, 30 second)
    22 //}
       
    23 
       
    24 //Await.result(f, 30 second)