test suite test option pattern
private boolean match a(character c) pure
return c == 'a' || c == 'A'
private boolean match b(character c) pure
return c == 'b' || c == 'B'
private boolean match c(character c) pure
return c == 'c' || c == 'C'
test case test match()
assert the pattern("ab")
assert the pattern("AAAA")
assert the pattern("AAAABB")
assert the pattern("bbc")
assert the pattern("BBCcc")
assert the pattern("Ccc")
assert !the pattern("abc")
assert !the pattern("baaaa")
assert !the pattern("accc")
test case test viable prefix()
assert the patternis viable prefix("")
assert the patternis viable prefix("a")
assert the patternis viable prefix("aAa")
assert the patternis viable prefix("aabb")
assert the patternis viable prefix("bb")
assert the patternis viable prefix("bbccc")
assert the patternis viable prefix("cc")
assert !the patternis viable prefix("x")
assert !the patternis viable prefix("xyz")
assert !the patternis viable prefix("ba")
assert !the patternis viable prefix("cca")
assert !the patternis viable prefix("Cccb")
test case test match prefix()
assert the patternmatch prefix("") is null
assert the patternmatch prefix("x") is null
assert the patternmatch prefix("xac") is null
assert the patternmatch prefix("xab") is null
assert the patternmatch prefix("abbc") == 3
assert the patternmatch prefix("bcdef") == 2
assert the patternmatch prefix("aAbBcCdef") == 4
assert the patternmatch prefix("bCabc") == 2
assert the patternmatch prefix("aaabbbcccddd") == 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("abcfoo", 3) is null
match : the patternfind first("xxaabbcczz", 0)
assert match is_not null
assert matchbegin == 2
assert matchend == 6
match2 : the patternfind first("aaabbbAAACCCBBB", 1)
assert match2 is_not null
assert match2begin == 1
assert match2end == 6
match3 : the patternfind first("aaabbbAAACCCBBB", 6)
assert match3 is_not null
assert match3begin == 6
assert match3end == 9
match4 : the patternfind first("fooACxyzABC", 0)
assert match4 is_not null
assert match4begin == 3
assert match4end == 4
match5 : the patternfind first("aaabbbAAACCCBBB", 9)
assert match5 is_not null
assert match5begin == 9
assert match5end == 12
test case test split()
split0 : the patternsplit("foo")
assert split0size == 1
assert equals(split0[0], "foo")
split1 : the patternsplit("fooBCxyzAB")
assert split1size == 3
assert equals(split1[0], "foo")
assert equals(split1[1], "xyz")
assert equals(split1[2], "")
split2 : the patternsplit("aaa1ab2BC3")
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