Added test cases

master
Aadhavan Srinivasan 2 months ago
parent 89a43c8f41
commit 4a30977d15

@ -19,6 +19,8 @@ var reTests = []struct {
{"(b|c|A)", "ooaoobocA", []matchIndex{{5, 6}, {7, 8}, {8, 9}}}, {"(b|c|A)", "ooaoobocA", []matchIndex{{5, 6}, {7, 8}, {8, 9}}},
{"ab*", "a", []matchIndex{{0, 1}}}, {"ab*", "a", []matchIndex{{0, 1}}},
{"ab*", "abb", []matchIndex{{0, 3}}}, {"ab*", "abb", []matchIndex{{0, 3}}},
{"a*b", "aaab", []matchIndex{{0, 4}}},
{"a*b", "qwqw", []matchIndex{}},
{"(abc)*", "abcabcabc", []matchIndex{{0, 9}}}, {"(abc)*", "abcabcabc", []matchIndex{{0, 9}}},
{"((abc)|(def))*", "abcdef", []matchIndex{{0, 6}}}, {"((abc)|(def))*", "abcdef", []matchIndex{{0, 6}}},
{"(abc)*|(def)*", "abcdef", []matchIndex{{0, 3}, {3, 3}, {3, 6}, {6, 6}}}, {"(abc)*|(def)*", "abcdef", []matchIndex{{0, 3}, {3, 3}, {3, 6}, {6, 6}}},
@ -30,6 +32,9 @@ var reTests = []struct {
{"a|b", "c", []matchIndex{}}, {"a|b", "c", []matchIndex{}},
{"(a|b)*c", "aabbc", []matchIndex{{0, 5}}}, {"(a|b)*c", "aabbc", []matchIndex{{0, 5}}},
{"a*", "aaaaaaaa", []matchIndex{{0, 8}, {8, 8}}}, {"a*", "aaaaaaaa", []matchIndex{{0, 8}, {8, 8}}},
{"ab?", "ab", []matchIndex{{0, 2}}},
{"a?b", "ab", []matchIndex{{0, 2}}},
{"a?", "", []matchIndex{{0, 0}}},
} }
func TestFindAllMatches(t *testing.T) { func TestFindAllMatches(t *testing.T) {

Loading…
Cancel
Save