MCPcopy Create free account
hub / github.com/sergi/go-diff / TestDiffXIndex

Function TestDiffXIndex

diffmatchpatch/diff_test.go:1176–1195  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1174}
1175
1176func TestDiffXIndex(t *testing.T) {
1177 type TestCase struct {
1178 Name string
1179
1180 Diffs []Diff
1181 Location int
1182
1183 Expected int
1184 }
1185
1186 dmp := New()
1187
1188 for i, tc := range []TestCase{
1189 {"Translation on equality", []Diff{{DiffDelete, "a"}, {DiffInsert, "1234"}, {DiffEqual, "xyz"}}, 2, 5},
1190 {"Translation on deletion", []Diff{{DiffEqual, "a"}, {DiffDelete, "1234"}, {DiffEqual, "xyz"}}, 3, 1},
1191 } {
1192 actual := dmp.DiffXIndex(tc.Diffs, tc.Location)
1193 assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name))
1194 }
1195}
1196
1197func TestDiffLevenshtein(t *testing.T) {
1198 type TestCase struct {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
DiffXIndexMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…