From c032dcb2ea68128e27564c2275d7c15a3b958bfd Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Sun, 3 Nov 2024 15:04:19 -0500 Subject: [PATCH] Added more test cases --- re_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/re_test.go b/re_test.go index 5a4178f..1c04fec 100644 --- a/re_test.go +++ b/re_test.go @@ -85,6 +85,7 @@ var reTests = []struct { {"b$", "ba", []matchIndex{}}, {"(boy|girl)$", "girlf", []matchIndex{}}, {`\bint\b`, "print int integer", []matchIndex{{6, 9}}}, + {`int\b`, "ints", []matchIndex{}}, {`int(\b|a)`, "inta", []matchIndex{{0, 4}}}, {`\b\d+\b`, "511 a3 43", []matchIndex{{0, 3}, {7, 9}}}, {`\Bint\B`, "prints int integer print", []matchIndex{{2, 5}}}, @@ -94,6 +95,19 @@ var reTests = []struct { {`^int$`, "print int integer", []matchIndex{}}, {`^int$`, "int", []matchIndex{{0, 3}}}, {`b*`, "aaaaaaaaaaqweqwe", []matchIndex{{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9}, {10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}}}, + + {"a{4}", "aabaaa", []matchIndex{}}, + {"ab{5}", "abbbbbab", []matchIndex{{0, 6}}}, + {"(a|b){3,4}", "aba", []matchIndex{{0, 3}}}, + {"(a|b){3,4}", "ababaa", []matchIndex{{0, 4}}}, + {"(bc){5,}", "bcbcbcbcbcbcbcbc", []matchIndex{{0, 16}}}, + {`\d{3,4}`, "1209", []matchIndex{{0, 4}}}, + {`\d{3,4}`, "109", []matchIndex{{0, 3}}}, + {`\d{3,4}`, "5", []matchIndex{}}, + {`\d{3,4}`, "89a-0", []matchIndex{}}, + {`\d{3,4}`, "ababab555", []matchIndex{{6, 9}}}, + {`\bpaint\b`, "paints", []matchIndex{}}, + {`\b\w{5}\b`, "paint", []matchIndex{{0, 5}}}, } func TestFindAllMatches(t *testing.T) {