marking4/re_test4.scala
changeset 486 9c03b5e89a2a
parent 485 19b75e899d37
child 487 efad9725dfd8
equal deleted inserted replaced
485:19b75e899d37 486:9c03b5e89a2a
     1 import CW9c._
       
     2 
       
     3 val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
       
     4 
       
     5 assert(ders(("a" * 5).toList, EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
       
     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)