test suite test procedure matcher
private boolean test predicate(character c) pure
return c == 'a' || c == 'b' || c == 'c'
private string as string(readonly list[character] char list)
return char listfrozen copy() !> string
test case test match()
assert the matcher("a")
assert the matcher("ab")
assert the matcher("abca")
assert !the matcher("")
assert !the matcher("abcda")
assert !the matcher("y")
assert !the matcher("xab")
assert the matcherparse("a") == "a"
assert the matcherparse("ab") == "ab"
assert the matcherparse("abca") == "abca"
test case test viable prefix()
assert the patternis viable prefix("")
assert the patternis viable prefix("a")
assert the patternis viable prefix("ab")
assert !the patternis viable prefix("y")
assert !the patternis viable prefix("ay")
test case test match prefix()
assert the patternmatch prefix("") is null
assert the patternmatch prefix("a") == 1
assert the patternmatch prefix("abc") == 3
assert the patternmatch prefix("abcdef") == 3
assert the patternmatch prefix("x") is null
assert the patternmatch prefix("xabc") is null
assert the patternmatch prefix("abcabc") == 6
test case test find first()
assert the patternfind first("", 0) is null
assert the patternfind first("foo", 0) is null
assert the patternfind first("bfoo", 1) is null
match : the patternfind first("a", 0)
assert match is_not null
assert matchbegin == 0
assert matchend == 1
match2 : the patternfind first("-abc-", 0)
assert match2 is_not null
assert match2begin == 1
assert match2end == 4
match3 : the patternfind first("ayzzybacy", 2)
assert match3 is_not null
assert match3begin == 5
assert match3end == 8
test case test split()
split0 : the patternsplit("foo")
assert split0size == 1
assert equals(split0[0], "foo")
split1 : the patternsplit("fooabcxyzc")
assert split1size == 3
assert equals(split1[0], "foo")
assert equals(split1[1], "xyz")
assert equals(split1[2], "")
split2 : the patternsplit("ab1bc2ca3")
assert split2size == 4
assert equals(split2[0], "")
assert equals(split2[1], "1")
assert equals(split2[2], "2")
assert equals(split2[3], "3")
boolean equals(immutable list[character] s0, string s1)
return (s0 !> string) == s1