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