test suite test repeat element
private boolean test predicate(character c) pure
return c == 'a' || c == 'b' || c == 'c'
test case test match()
assert zero or more("")
assert zero or more("a")
assert zero or more("abca")
assert !zero or more("abcda")
assert !zero or more("y")
assert !zero or more("xab")
assert !one or more("")
assert one or more("a")
assert one or more("abca")
assert !one or more("abcda")
assert !one or more("y")
assert !one or more("xab")
test case test viable prefix()
assert zero or moreis viable prefix("")
assert zero or moreis viable prefix("a")
assert zero or moreis viable prefix("ab")
assert !zero or moreis viable prefix("y")
assert !zero or moreis viable prefix("ay")
assert one or moreis viable prefix("")
assert one or moreis viable prefix("a")
assert one or moreis viable prefix("ab")
assert !one or moreis viable prefix("y")
assert !one or moreis viable prefix("ay")
test case test match prefix()
assert zero or morematch prefix("") == 0
assert zero or morematch prefix("a") == 1
assert zero or morematch prefix("abc") == 3
assert zero or morematch prefix("abcdef") == 3
assert zero or morematch prefix("x") == 0
assert zero or morematch prefix("xabc") == 0
assert zero or morematch prefix("abcabc") == 6
assert one or morematch prefix("") is null
assert one or morematch prefix("a") == 1
assert one or morematch prefix("abc") == 3
assert one or morematch prefix("abcdef") == 3
assert one or morematch prefix("x") is null
assert one or morematch prefix("xabc") is null
assert one or morematch 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
match4 : the pattern2find first("", 0)
assert match4 is_not null
assert match4begin == 0
assert match4end == 0
match5 : the pattern2find first("xyz", 2)
assert match5 is_not null
assert match5begin == 2
assert match5end == 2
match6 : the pattern2find first("xabcd", 1)
assert match6 is_not null
assert match6begin == 1
assert match6end == 4
match7 : the pattern2find first("ayzzybacy", 2)
assert match7 is_not null
assert match7begin == 2
assert match7end == 2
test case test find last()
assert the patternfind last("", missinginstance) is null
assert the patternfind last("foo", missinginstance) is null
assert the patternfind last("foo", 3) is null
assert the patternfind last("fooc", 3) is null
match : the patternfind last("c", 1)
assert match is_not null
assert matchbegin == 0
assert matchend == 1
match2 : the patternfind last("ayzzzby", 6)
assert match2 is_not null
assert match2begin == 5
assert match2end == 6
match3 : the patternfind last("abczyby", 4)
assert match3 is_not null
assert match3begin == 0
assert match3end == 3
match4 : the patternfind last("ayzzyabcy", missinginstance)
assert match4 is_not null
assert match4begin == 5
assert match4end == 8
match5 : the pattern2find last("", missinginstance)
assert match5 is_not null
assert match5begin == 0
assert match5end == 0
match6 : the pattern2find last("foobar", 2)
assert match6 is_not null
assert match6begin == 2
assert match6end == 2
match7 : the pattern2find last("foobar", 5)
assert match7 is_not null
assert match7begin == 3
assert match7end == 5
match8 : the pattern2find last("ayzzyabcy", missinginstance)
assert match8 is_not null
assert match8begin == 9
assert match8end == 9
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