1 import M3._ |
1 import M3._ |
2 |
2 |
3 val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b')) |
3 assert(denest(List(ONE, ZERO, ALTs(List(ONE, CHAR('a'))))) |
4 |
4 == List(ONE, ONE, CHAR('a'))) |
5 assert(ders(("a" * 5).toList, EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))) |
5 assert(denest(List(ONE ~ ONE, ZERO, ZERO | ONE)) == List(ONE ~ ONE, ZERO, ONE)) |
6 assert(ders(List('b'), EVIL_urban) == ONE) |
|
7 assert(ders(List('b','b'), EVIL_urban) == ZERO) |
|
8 assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true) |
|
9 assert(matcher(EVIL_urban, "a" * 50 ++ "b") == true) |
|
10 assert(matcher(EVIL_urban, "a" * 50) == false) |
|
11 assert(matcher(EVIL_urban, "b") == true) |
|
12 assert(matcher(EVIL_urban, "bb") == false) |
|
13 assert(matcher("abc", "abc") == true) |
|
14 assert(matcher("abc", "ab") == false) |
|
15 assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true) |
|
16 assert(matcher(ONE, "") == true) |
|
17 assert(matcher(ZERO, "") == false) |
|
18 assert(matcher(ONE | CHAR('a'), "") == true) |
|
19 assert(matcher(ONE | CHAR('a'), "a") == true) |
|