Added some AI-generated test cases (llama3.1:405b)

master
Aadhavan Srinivasan 1 month ago
parent 21b2d5a2a9
commit 924e2a8dbc

@ -115,6 +115,37 @@ var reTests = []struct {
{`.+`, "úïäö´«åæïëòöê»éãçâï«úïòíñ", []MatchIndex{{0, 25}}}, {`.+`, "úïäö´«åæïëòöê»éãçâï«úïòíñ", []MatchIndex{{0, 25}}},
{`a.b`, "a²b", []MatchIndex{{0, 3}}}, {`a.b`, "a²b", []MatchIndex{{0, 3}}},
{`[^a]+`, "úïäö´«åæïëòöê»éãçâï«úïòíñ", []MatchIndex{{0, 25}}}, {`[^a]+`, "úïäö´«åæïëòöê»éãçâï«úïòíñ", []MatchIndex{{0, 25}}},
// Fun experiment - AI-generated tests
{"(abc|def|ghi)", "abcdefg", []MatchIndex{{0, 3}, {3, 6}}},
{"a(b|c)d", "abcd", []MatchIndex{}},
{"a(b|c)*d", "abcbcd", []MatchIndex{{0, 6}}},
{"a(b|c)+d", "abcbcd", []MatchIndex{{0, 6}}},
{"a(b|c)?d", "abd", []MatchIndex{{0, 3}}},
{".+", "hello world", []MatchIndex{{0, 11}}},
{"a.b", "aXb", []MatchIndex{{0, 3}}},
{"a.*b", "aXb", []MatchIndex{{0, 3}}},
{"a.{2,3}b", "aXXb", []MatchIndex{{0, 4}}},
{"a.{2,}b", "aXXXb", []MatchIndex{{0, 5}}},
{"a.{0,3}b", "ab", []MatchIndex{{0, 2}}},
{"[abc]+", "abcabc", []MatchIndex{{0, 6}}},
{"[a-zA-Z]+", "HelloWorld", []MatchIndex{{0, 10}}},
{"[^abc]+", "defghi", []MatchIndex{{0, 6}}},
{"^hello", "hello world", []MatchIndex{{0, 5}}},
{"world$", "hello world", []MatchIndex{{6, 11}}},
{`\bhello\b`, "hello world", []MatchIndex{{0, 5}}},
{`\Bhello\B`, "hello world", []MatchIndex{}},
{"(hello|world)", "hello world", []MatchIndex{{0, 5}, {6, 11}}},
{"(hello|world)+", "hello world", []MatchIndex{{0, 5}, {6, 11}}},
{"(hello|world)*", "hello world", []MatchIndex{{0, 5}, {5, 5}, {6, 11}, {11, 11}}},
{"(hello|world)?", "hello world", []MatchIndex{{0, 5}, {5, 5}, {6, 11}, {11, 11}}},
{"ú.+ï", "úïäö´«åæïëòöê»éãçâï«úïòíñ", []MatchIndex{{0, 22}}},
{"(?=hello)", "hello world", []MatchIndex{{0, 0}}},
{"(?!hello)", "hello world", []MatchIndex{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9}, {10, 10}, {11, 11}}},
{"(?<=hello)", "hello world", []MatchIndex{{5, 5}}},
{"(?<!hello)", "hello world", []MatchIndex{{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {6, 6}, {7, 7}, {8, 8}, {9, 9}, {10, 10}, {11, 11}}},
// Todo - add lookaround tests
} }
func TestFindAllMatches(t *testing.T) { func TestFindAllMatches(t *testing.T) {

Loading…
Cancel
Save