From 924e2a8dbcac437a1ee7eed2dabb6349bc72a286 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Fri, 22 Nov 2024 00:12:41 -0500 Subject: [PATCH] Added some AI-generated test cases (llama3.1:405b) --- re_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/re_test.go b/re_test.go index 6cfc605..28b80c9 100644 --- a/re_test.go +++ b/re_test.go @@ -115,6 +115,37 @@ var reTests = []struct { {`.+`, "úïäö´«åæïëòöê»éãçâï«úïòíñ", []MatchIndex{{0, 25}}}, {`a.b`, "a²b", []MatchIndex{{0, 3}}}, {`[^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}}}, + {"(?