marking3/re1d_test.scala
changeset 168 03530cb87cd0
equal deleted inserted replaced
167:349d706586ef 168:03530cb87cd0
       
     1 
       
     2 import CW8a._
       
     3 
       
     4 val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
       
     5 
       
     6 assert(ders(("a" * 5).toList, EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
       
     7 assert(ders(List('b'), EVIL_urban) == ONE)
       
     8 assert(ders(List('b','b'), EVIL_urban) == ZERO)
       
     9 assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true)
       
    10 assert(matcher(EVIL_urban, "a" * 500 ++ "b") == true)
       
    11 assert(matcher(EVIL_urban, "a" * 500) == false)
       
    12 assert(matcher(EVIL_urban, "b") == true)
       
    13 assert(matcher(EVIL_urban, "bb") == false)
       
    14 assert(matcher("abc", "abc") == true)
       
    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)