main_testing3/re_test3.scala
changeset 475 59e005dcf163
parent 433 6af86ba1208f
equal deleted inserted replaced
474:b528d1d3d3c3 475:59e005dcf163
     1 import M3._
     1 
       
     2 def urbanmain() = {
       
     3 
       
     4   import M3._
     2 
     5 
     3 
     6 
     4 assert(simp(ZERO | ONE) == ONE)
     7   assert(simp(ZERO | ONE) == ONE)
     5 assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
     8   assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
     6 assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
     9   assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
     7 assert(simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
    10   assert(simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
     8 assert(simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
    11   assert(simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
     9 assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
    12   assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
    10 assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
    13   assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
    11 assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
    14   assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
    12 assert(simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a'))
    15   assert(simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a'))
    13 assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
    16   assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
    14 assert(simp(ALT((CHAR('a') | ZERO) ~ ONE,
    17   assert(simp(ALT((CHAR('a') | ZERO) ~ ONE, ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
    15                   ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
    18   assert(simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO)
    16 assert(simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO)
    19   assert(simp(ALT(ONE | ONE, ONE | ONE)) == ONE)
    17 assert(simp(ALT(ONE | ONE, ONE | ONE)) == ONE)
    20   assert(simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a'))
    18 assert(simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a'))
    21   assert(simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE, CHAR('a')))
    19 assert(simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE, CHAR('a')))
    22   assert(simp(ALTs(Nil)) == ZERO)
    20 assert(simp(ALTs(Nil)) == ZERO)
    23   assert(simp(SEQs(List(CHAR('a')))) == CHAR('a'))
    21 assert(simp(SEQs(List(CHAR('a')))) == CHAR('a'))
       
    22 
    24 
       
    25 }