marking/re1d_test.scala
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 20 Dec 2016 01:48:09 +0000
changeset 92 cfff88de2ff5
child 93 21f41e08457d
permissions -rw-r--r--
updatd


import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
import scala.language.postfixOps 


val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))

lazy val f = Future {
  assert(ders(List.fill(5)('a'), EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
  assert(ders(List('b'), EVIL) == ONE)
  assert(ders(List('b','b'), EVIL) == ZERO)
  assert(matcher(EVIL, "a" * 5 ++ "b") == true)
  assert(matcher(EVIL, "b") == true)
  assert(matcher(EVIL, "bb") == false)
  assert(matcher("abc", "abc") == true)
  assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
  assert(matcher(ONE, "") == true)
  assert(matcher(ZERO, "") == false)
  assert(matcher(ONE | CHAR('a'), "") == true)
  assert(matcher(ONE | CHAR('a'), "a") == true)
}

Await.result(f, 90 second)