testing4/re_test4.scala
author Christian Urban <urbanc@in.tum.de>
Thu, 31 Oct 2019 12:01:56 +0000
changeset 300 72688efdf17c
parent 221 9e7897f25e13
permissions -rw-r--r--
updated testing files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
     1
import CW9c._
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
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 221
diff changeset
     5
assert(ders(("a" * 5).toList, EVIL_urban) == SEQ(SEQ(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)