main_marking3/re_test4.scala
changeset 390 175a950470a9
child 424 daf561a83ba6
equal deleted inserted replaced
389:4113d4d8cf62 390:175a950470a9
       
     1 import CW8c._
       
     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)