marking4/re_test4.scala
changeset 245 975d34506e88
parent 227 b5f3e814a710
child 288 65731df141a5
equal deleted inserted replaced
244:a359976a6f3e 245:975d34506e88
       
     1 
       
     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)