=========================================================================== FuzzMatchStdlib - Fuzz Match/MatchString ===========================================================================
(f *testing.F)
| 215 | // =========================================================================== |
| 216 | |
| 217 | func FuzzMatchStdlib(f *testing.F) { |
| 218 | // Add seed corpus |
| 219 | for _, p := range seedPatterns { |
| 220 | for _, i := range seedInputs { |
| 221 | f.Add(p, i) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | f.Fuzz(func(t *testing.T, pattern, input string) { |
| 226 | // Skip invalid patterns |
| 227 | stdRe, err := regexp.Compile(pattern) |
| 228 | if err != nil { |
| 229 | return |
| 230 | } |
| 231 | |
| 232 | cgRe, err := Compile(pattern) |
| 233 | if err != nil { |
| 234 | t.Fatalf("coregex failed to compile valid pattern %q: %v", pattern, err) |
| 235 | } |
| 236 | |
| 237 | // Compare MatchString |
| 238 | stdMatchStr := stdRe.MatchString(input) |
| 239 | cgMatchStr := cgRe.MatchString(input) |
| 240 | if stdMatchStr != cgMatchStr { |
| 241 | t.Errorf("MatchString(%q, %q):\n stdlib: %v\n coregex: %v", |
| 242 | pattern, input, stdMatchStr, cgMatchStr) |
| 243 | } |
| 244 | }) |
| 245 | } |
| 246 | |
| 247 | // =========================================================================== |
| 248 | // FuzzFindStdlib - Fuzz Find/FindString/FindIndex |
nothing calls this directly
no test coverage detected