marking3/re1d_test.scala
author Christian Urban <urbanc@in.tum.de>
Sat, 16 Jun 2018 20:55:51 +0100
changeset 185 5ab45f3fee1c
parent 168 03530cb87cd0
permissions -rw-r--r--
updated


import CW8a._

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

assert(ders(("a" * 5).toList, EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
assert(ders(List('b'), EVIL_urban) == ONE)
assert(ders(List('b','b'), EVIL_urban) == ZERO)
assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true)
assert(matcher(EVIL_urban, "a" * 500 ++ "b") == true)
assert(matcher(EVIL_urban, "a" * 500) == false)
assert(matcher(EVIL_urban, "b") == true)
assert(matcher(EVIL_urban, "bb") == false)
assert(matcher("abc", "abc") == true)
assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
assert(matcher(ONE, "") == true)
assert(matcher(ZERO, "") == false)
assert(matcher(ONE | CHAR('a'), "") == true)
assert(matcher(ONE | CHAR('a'), "a") == true)