test suite test singleton pattern
test case test match()
assert the pattern("x")
assert !the pattern("y")
assert !the pattern("xx")
test case test viable prefix()
assert the pattern • is viable prefix("")
assert the pattern • is viable prefix("x")
assert !the pattern • is viable prefix("y")
assert !the pattern • is viable prefix("xx")
test case test match prefix()
assert the pattern • match prefix("") is null
assert the pattern • match prefix("x") == 1
assert the pattern • match prefix("y") is null
assert the pattern • match prefix("xx") == 1
test case test find first()
assert the pattern • find first("", 0) is null
assert the pattern • find first("foo", 0) is null
assert the pattern • find first("xfoo", 1) is null
match : the pattern • find first("x", 0)
assert match is_not null
assert match • begin == 0
assert match • end == 1
match2 : the pattern • find first("xyzzyxy", 2)
assert match2 is_not null
assert match2 • begin == 5
assert match2 • end == 6
test case test find last()
assert the pattern • find last("", missing • instance) is null
assert the pattern • find last("foo", missing • instance) is null
assert the pattern • find last("foo", 3) is null
assert the pattern • find last("foox", 3) is null
match : the pattern • find last("x", 1)
assert match is_not null
assert match • begin == 0
assert match • end == 1
match2 : the pattern • find last("xyzzyxy", 6)
assert match2 is_not null
assert match2 • begin == 5
assert match2 • end == 6
match3 : the pattern • find last("xyzzyxy", 4)
assert match3 is_not null
assert match3 • begin == 0
assert match3 • end == 1
match4 : the pattern • find last("xyzzyxy", missing • instance)
assert match4 is_not null
assert match4 • begin == 5
assert match4 • end == 6
test case test split()
split0 : the pattern • split("foo")
assert split0 • size == 1
assert equals(split0[0], "foo")
split1 : the pattern • split("fooxbarx")
assert split1 • size == 3
assert equals(split1[0], "foo")
assert equals(split1[1], "bar")
assert equals(split1[2], "")
split2 : the pattern • split("x1x2x3")
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