marking4/re_test3.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 15 Jan 2021 02:47:51 +0000
changeset 385 44383203970f
parent 288 65731df141a5
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 245
diff changeset
     1
import CW9c._
168
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
assert(simp(ZERO | ONE) == ONE)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
245
975d34506e88 added marking
Christian Urban <urbanc@in.tum.de>
parents: 227
diff changeset
     7
assert(simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
975d34506e88 added marking
Christian Urban <urbanc@in.tum.de>
parents: 227
diff changeset
     8
assert(simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
168
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
assert(simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a'))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
assert(simp(ALT((CHAR('a') | ZERO) ~ ONE,
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
                  ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
assert(simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
assert(simp(ALT(ONE | ONE, ONE | ONE)) == ONE)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
assert(simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a'))
245
975d34506e88 added marking
Christian Urban <urbanc@in.tum.de>
parents: 227
diff changeset
    19
assert(simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE | CHAR('a'), CHAR('a') | ONE))
168
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
245
975d34506e88 added marking
Christian Urban <urbanc@in.tum.de>
parents: 227
diff changeset
    21