testing3/re1d_test.scala
author Christian Urban <urbanc@in.tum.de>
Tue, 10 Jul 2018 15:12:14 +0100
changeset 190 2f989951d147
parent 160 863feeb5c760
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
160
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
     2
//import scala.concurrent._
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
     3
//import scala.concurrent.duration._
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
     4
//import ExecutionContext.Implicits.global
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
     5
//import scala.language.postfixOps 
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
     6
//import scala.language.reflectiveCalls
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
160
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
    10
//lazy val f = Future {
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  import CW8a._
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  //println("1")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  assert(ders(List.fill(5)('a'), EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
  //println("2")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  assert(ders(List('b'), EVIL_urban) == ONE)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  //println("3")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
  assert(ders(List('b','b'), EVIL_urban) == ZERO)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  //println("4")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  //println("5")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  assert(matcher(EVIL_urban, "b") == true)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
  //println("6") 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  assert(matcher(EVIL_urban, "bb") == false)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  //println("7")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  assert(matcher("abc", "abc") == true)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  //println("8")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
  //println("9")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  assert(matcher(ONE, "") == true)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  //println("10")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  assert(matcher(ZERO, "") == false)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  //println("11")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  assert(matcher(ONE | CHAR('a'), "") == true)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  //println("12")
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
  assert(matcher(ONE | CHAR('a'), "a") == true)
160
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
    39
//}
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
160
863feeb5c760 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
    41
//Await.result(f, 90 second)