168
|
1 |
|
|
2 |
import CW8a._
|
|
3 |
|
|
4 |
|
|
5 |
assert(simp(ZERO | ONE) == ONE)
|
|
6 |
assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
|
|
7 |
assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
|
|
8 |
assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
|
|
9 |
assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
|
|
10 |
assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
|
|
11 |
assert(simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a'))
|
|
12 |
assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
|
|
13 |
assert(simp(ALT((CHAR('a') | ZERO) ~ ONE,
|
|
14 |
((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
|
|
15 |
assert(simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO)
|
|
16 |
assert(simp(ALT(ONE | ONE, ONE | ONE)) == ONE)
|
|
17 |
assert(simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a'))
|
|
18 |
assert(simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next) == ONE)
|
|
19 |
|