main_testing3/re_test9.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 06 Jun 2024 22:18:15 +0100
changeset 490 4778fefecd0c
parent 475 59e005dcf163
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
475
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
     1
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
     2
def urbanmain() = {
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
475
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
     4
  import M3._
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
     5
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
     6
  val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
475
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
     9
  assert(simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next) == ONE)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
    10
  assert(simp(Iterator.iterate(ONE:Rexp)(r => ALT(r, r)).drop(20).next) == ONE)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
    11
  assert(matcher(EVIL_urban, "a" * 1000000) == false)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
    12
  assert(matcher(EVIL_urban, "a" * 1000000 ++ "b") == true)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
    13
}