3 import scala.concurrent.duration._ |
3 import scala.concurrent.duration._ |
4 import ExecutionContext.Implicits.global |
4 import ExecutionContext.Implicits.global |
5 import scala.language.postfixOps |
5 import scala.language.postfixOps |
6 |
6 |
7 |
7 |
8 val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b')) |
8 val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b')) |
9 |
9 |
10 lazy val f = Future { |
10 lazy val f = Future { |
11 assert(ders(List.fill(5)('a'), EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))) |
11 println("1") |
12 assert(ders(List('b'), EVIL) == ONE) |
12 assert(ders(List.fill(5)('a'), EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))) |
13 assert(ders(List('b','b'), EVIL) == ZERO) |
13 println("2") |
14 assert(matcher(EVIL, "a" * 5 ++ "b") == true) |
14 assert(ders(List('b'), EVIL_urban) == ONE) |
15 assert(matcher(EVIL, "b") == true) |
15 println("3") |
16 assert(matcher(EVIL, "bb") == false) |
16 assert(ders(List('b','b'), EVIL_urban) == ZERO) |
|
17 println("4") |
|
18 assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true) |
|
19 println("5") |
|
20 assert(matcher(EVIL_urban, "b") == true) |
|
21 println("6") |
|
22 assert(matcher(EVIL_urban, "bb") == false) |
|
23 println("7") |
17 assert(matcher("abc", "abc") == true) |
24 assert(matcher("abc", "abc") == true) |
|
25 println("8") |
18 assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true) |
26 assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true) |
|
27 println("9") |
19 assert(matcher(ONE, "") == true) |
28 assert(matcher(ONE, "") == true) |
|
29 println("10") |
20 assert(matcher(ZERO, "") == false) |
30 assert(matcher(ZERO, "") == false) |
|
31 println("11") |
21 assert(matcher(ONE | CHAR('a'), "") == true) |
32 assert(matcher(ONE | CHAR('a'), "") == true) |
|
33 println("12") |
22 assert(matcher(ONE | CHAR('a'), "a") == true) |
34 assert(matcher(ONE | CHAR('a'), "a") == true) |
23 } |
35 } |
24 |
36 |
25 Await.result(f, 90 second) |
37 Await.result(f, 90 second) |