marking/re1d_test.scala
changeset 92 cfff88de2ff5
child 93 21f41e08457d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking/re1d_test.scala	Tue Dec 20 01:48:09 2016 +0000
@@ -0,0 +1,25 @@
+
+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)