Added test cases

master
Aadhavan Srinivasan 2 months ago
parent 3778869567
commit 49b84c5728

@ -31,7 +31,9 @@ var reTests = []struct {
{"a*", "", []matchIndex{{0, 0}}},
{"a|b", "c", []matchIndex{}},
{"(a|b)*c", "aabbc", []matchIndex{{0, 5}}},
{"a(b|b)", "ab", []matchIndex{{0, 2}}},
{"a*", "aaaaaaaa", []matchIndex{{0, 8}, {8, 8}}},
{"ab?", "ab", []matchIndex{{0, 2}}},
{"a?b", "ab", []matchIndex{{0, 2}}},
{"a?", "", []matchIndex{{0, 0}}},
@ -40,7 +42,20 @@ var reTests = []struct {
{"a?b?c?", "ac", []matchIndex{{0, 2}}},
{"a?b?c", "abc", []matchIndex{{0, 3}}},
{"a?b?c", "acb", []matchIndex{{0, 2}}},
{"a(b|b)", "ab", []matchIndex{{0, 2}}},
{"[abc]", "defadefbdefce", []matchIndex{{3, 4}, {7, 8}, {11, 12}}},
{"[ab]c", "ab", []matchIndex{}},
{"g[ab]c", "gac", []matchIndex{{0, 3}}},
{"g[ab]c", "gbc", []matchIndex{{0, 3}}},
{"g[ab]c", "gc", []matchIndex{}},
{"g[ab]c", "gfc", []matchIndex{}},
{"[ab]*", "aabbbabaababab", []matchIndex{{0, 14}}},
{"[ab]+", "aabbbabaababab", []matchIndex{{0, 14}}},
{"[Ff]r[Uu]it", "fruit", []matchIndex{{0, 5}}},
{"[Ff]r[Uu]it", "FrUit", []matchIndex{{0, 5}}},
{"[Ff]r[Uu|]it", "Fr|it", []matchIndex{{0, 5}}},
{"[Ff]r([Uu]|[pP])it", "Frpit", []matchIndex{{0, 5}}},
{"[Ff]r[Uu]|[pP]it", "Frpit", []matchIndex{{2, 5}}},
}
func TestFindAllMatches(t *testing.T) {

Loading…
Cancel
Save