main_testing3/re_test7.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 02 Nov 2023 11:32:10 +0000
changeset 472 6a77c260c8a5
parent 433 6af86ba1208f
child 475 59e005dcf163
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
403
ffce7b61b446 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
     1
import M3._
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     3
val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
     5
assert(ders(("a" * 5).toList, EVIL_urban) == SEQs(List(STAR(CHAR('a')), STAR(STAR(CHAR('a'))), CHAR('b'))))
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     6
assert(ders(List('b'), EVIL_urban) == ONE)
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
     7
assert(ders(List('b','b'), EVIL_urban) == ZERO)
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     8
assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true)
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
     9
assert(matcher(EVIL_urban, "a" * 50 ++ "b") == true)
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    10
assert(matcher(EVIL_urban, "a" * 50) == false)
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    11
assert(matcher(EVIL_urban, "b") == true)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    12
assert(matcher(EVIL_urban, "bb") == false)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    13
assert(matcher("abc", "abc") == true)
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
    14
assert(matcher("abc", "ab") == false)
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    15
assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    16
assert(matcher(ONE, "") == true)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    17
assert(matcher(ZERO, "") == false)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    18
assert(matcher(ONE | CHAR('a'), "") == true)
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    19
assert(matcher(ONE | CHAR('a'), "a") == true)