main_testing3/re_test6.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 02 Nov 2020 02:31:44 +0000
changeset 347 4de31fdc0d67
parent 300 testing4/re_test6.scala@72688efdf17c
child 403 ffce7b61b446
permissions -rw-r--r--
updated

import CW8c._

val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))


assert(simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next) == ONE)
assert(simp(Iterator.iterate(ONE:Rexp)(r => ALT(r, r)).drop(20).next) == ONE)
assert(matcher(EVIL_urban, "a" * 1000000) == false)
assert(matcher(EVIL_urban, "a" * 1000000 ++ "b") == true)