MCPcopy Create free account
hub / github.com/coregx/coregex / TestGoAWK_SplitPattern

Function TestGoAWK_SplitPattern

goawk_bench_test.go:68–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestGoAWK_SplitPattern(t *testing.T) {
69 // Pattern: f[a-z]x matches "fox", "fax", "fix"
70 pattern := `f[a-z]x`
71 input := goawkSplitInput
72
73 reCoregex := coregex.MustCompile(pattern)
74 reStdlib := regexp.MustCompile(pattern)
75
76 // Test Split
77 splitCoregex := reCoregex.Split(input, -1)
78 splitStdlib := reStdlib.Split(input, -1)
79
80 if len(splitCoregex) != len(splitStdlib) {
81 t.Errorf("Split count mismatch: coregex=%d, stdlib=%d", len(splitCoregex), len(splitStdlib))
82 }
83
84 for i := range splitCoregex {
85 if i < len(splitStdlib) && splitCoregex[i] != splitStdlib[i] {
86 t.Errorf("Split[%d] mismatch: coregex=%q, stdlib=%q", i, splitCoregex[i], splitStdlib[i])
87 }
88 }
89
90 // Test FindAllString
91 allCoregex := reCoregex.FindAllString(input, -1)
92 allStdlib := reStdlib.FindAllString(input, -1)
93
94 if len(allCoregex) != len(allStdlib) {
95 t.Errorf("FindAllString count mismatch: coregex=%d, stdlib=%d", len(allCoregex), len(allStdlib))
96 }
97}
98
99func TestGoAWK_SubPattern(t *testing.T) {
100 // Pattern: f[a-z]x for replacement

Callers

nothing calls this directly

Calls 3

MustCompileFunction · 0.92
FindAllStringMethod · 0.80
SplitMethod · 0.45

Tested by

no test coverage detected