MCPcopy
hub / github.com/google/go-cmp / testStrings

Function testStrings

cmp/internal/diff/diff_test.go:340–354  ·  view source on GitHub ↗
(t *testing.T, x, y string)

Source from the content-addressed store, hash-verified

338}
339
340func testStrings(t *testing.T, x, y string) EditScript {
341 es := Difference(len(x), len(y), func(ix, iy int) Result {
342 return compareByte(x[ix], y[iy])
343 })
344 if es.LenX() != len(x) {
345 t.Errorf("es.LenX = %d, want %d", es.LenX(), len(x))
346 }
347 if es.LenY() != len(y) {
348 t.Errorf("es.LenY = %d, want %d", es.LenY(), len(y))
349 }
350 if !validateScript(x, y, es) {
351 t.Errorf("invalid edit script: %v", es)
352 }
353 return es
354}
355
356func validateScript(x, y string, es EditScript) bool {
357 var bx, by []byte

Callers 2

TestDifferenceFunction · 0.85
TestDifferenceFuzzFunction · 0.85

Calls 6

DifferenceFunction · 0.85
compareByteFunction · 0.85
validateScriptFunction · 0.85
LenXMethod · 0.80
LenYMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected