marking4/re_test4.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 13 Jan 2022 12:34:43 +0000
changeset 422 217bbd700594
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
val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
assert(ders(("a" * 5).toList, EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
assert(ders(List('b'), EVIL_urban) == ONE)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
assert(ders(List('b','b'), EVIL_urban) == ZERO)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true)
245
975d34506e88 added marking
Christian Urban <urbanc@in.tum.de>
parents: 227
diff changeset
     9
assert(matcher(EVIL_urban, "a" * 50 ++ "b") == true)
975d34506e88 added marking
Christian Urban <urbanc@in.tum.de>
parents: 227
diff changeset
    10
assert(matcher(EVIL_urban, "a" * 50) == false)
168
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
assert(matcher(EVIL_urban, "b") == true)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
assert(matcher(EVIL_urban, "bb") == false)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
assert(matcher("abc", "abc") == true)
245
975d34506e88 added marking
Christian Urban <urbanc@in.tum.de>
parents: 227
diff changeset
    14
assert(matcher("abc", "ab") == false)
168
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
assert(matcher(ONE, "") == true)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
assert(matcher(ZERO, "") == false)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
assert(matcher(ONE | CHAR('a'), "") == true)
03530cb87cd0 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
assert(matcher(ONE | CHAR('a'), "a") == true)