test suite test list pattern
test case test match()
the pattern : list pattern[character] • new("abc")
assert the pattern("abc")
assert !the pattern("xx")
assert !the pattern("ab")
assert !the pattern("abcd")
test case test viable prefix()
the pattern : list pattern[character] • new("abc")
assert the pattern • is viable prefix("")
assert the pattern • is viable prefix("a")
assert the pattern • is viable prefix("abc")
assert !the pattern • is viable prefix("xy")
assert !the pattern • is viable prefix("aa")
assert !the pattern • is viable prefix("abcdef")
test case test match prefix()
the pattern : list pattern[character] • new("abc")
assert the pattern • match prefix("") is null
assert the pattern • match prefix("abc") == 3
assert the pattern • match prefix("ab") is null
assert the pattern • match prefix("abcdef") == 3
test case test find first()
the pattern : list pattern[character] • new("abc")
assert the pattern • find first("", 0) is null
assert the pattern • find first("foo", 0) is null
assert the pattern • find first("bca", 1) is null
match : the pattern • find first("abc", 0)
assert match is_not null
assert match • begin == 0
assert match • end == 3
match2 : the pattern • find first("abcxabcdef", 2)
assert match2 is_not null
assert match2 • begin == 4
assert match2 • end == 7
test case test split()
the pattern : list pattern[character] • new("abc")
split0 : the pattern • split("foo")
assert split0 • size == 1
assert equals(split0[0], "foo")
split1 : the pattern • split("fooabcxyzabc")
assert split1 • size == 3
assert equals(split1[0], "foo")
assert equals(split1[1], "xyz")
assert equals(split1[2], "")
split2 : the pattern • split("abc1abc2abc3")
assert split2 • size == 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