# HG changeset patch # User Christian Urban # Date 1482198489 0 # Node ID cfff88de2ff52d2ac5b415e82fe49ae5dfacee78 # Parent b43c81c65341a73a7ca5cc1f57e805d17bb4f486 updatd diff -r b43c81c65341 -r cfff88de2ff5 marking/re1c_test.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/marking/re1c_test.scala Tue Dec 20 01:48:09 2016 +0000 @@ -0,0 +1,19 @@ + +import scala.concurrent._ +import scala.concurrent.duration._ +import ExecutionContext.Implicits.global +import scala.language.postfixOps + + + +lazy val f = Future { + assert(simp(ZERO | ONE) == ONE) + assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE)) + assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a')) + assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO) + assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a')) + assert(simp(CHAR('a') | CHAR('a')) == CHAR('a')) + assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a'))) +} + +Await.result(f, 30 second) diff -r b43c81c65341 -r cfff88de2ff5 marking/re1d_test.scala --- /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) diff -r b43c81c65341 -r cfff88de2ff5 marking/re1e_test.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/marking/re1e_test.scala Tue Dec 20 01:48:09 2016 +0000 @@ -0,0 +1,14 @@ + +import scala.concurrent._ +import scala.concurrent.duration._ +import ExecutionContext.Implicits.global +import scala.language.postfixOps + + + +lazy val f = Future { + assert(replace("aa".% | "bb", "aabbbaaaaaaabaaaaabbaaaabb" , "c") == "ccbcabcaccc") + assert(replace("aa".% | "bb", "abba" , "") == "aa") +} + +Await.result(f, 120 second)