main_testing3/re_test3.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 02 Nov 2020 02:31:44 +0000
changeset 347 4de31fdc0d67
parent 300 testing4/re_test3.scala@72688efdf17c
child 403 ffce7b61b446
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 300
diff changeset
     1
import CW8c._
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     4
assert(simp(ZERO | ONE) == ONE)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     5
assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     6
assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
     7
assert(simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
     8
assert(simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     9
assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    10
assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    11
assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    12
assert(simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a'))
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    13
assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    14
assert(simp(ALT((CHAR('a') | ZERO) ~ ONE,
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    15
                  ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    16
assert(simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO)
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    17
assert(simp(ALT(ONE | ONE, ONE | ONE)) == ONE)
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    18
assert(simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a'))
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    19
assert(simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE | CHAR('a'), CHAR('a') | ONE))
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    21