marking4/re_test3.scala
changeset 486 9c03b5e89a2a
parent 485 19b75e899d37
child 487 efad9725dfd8
equal deleted inserted replaced
485:19b75e899d37 486:9c03b5e89a2a
     1 import CW9c._
       
     2 
       
     3 
       
     4 assert(simp(ZERO | ONE) == ONE)
       
     5 assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
       
     6 assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
       
     7 assert(simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
       
     8 assert(simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
       
     9 assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
       
    10 assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
       
    11 assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
       
    12 assert(simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a'))
       
    13 assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
       
    14 assert(simp(ALT((CHAR('a') | ZERO) ~ ONE,
       
    15                   ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
       
    16 assert(simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO)
       
    17 assert(simp(ALT(ONE | ONE, ONE | ONE)) == ONE)
       
    18 assert(simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a'))
       
    19 assert(simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE | CHAR('a'), CHAR('a') | ONE))
       
    20 
       
    21