(t *testing.T)
| 1198 | } |
| 1199 | |
| 1200 | func TestDiffXIndex(t *testing.T) { |
| 1201 | type TestCase struct { |
| 1202 | Name string |
| 1203 | |
| 1204 | Diffs []Diff |
| 1205 | Location int |
| 1206 | |
| 1207 | Expected int |
| 1208 | } |
| 1209 | |
| 1210 | dmp := New() |
| 1211 | |
| 1212 | for i, tc := range []TestCase{ |
| 1213 | {"Translation on equality", []Diff{{DiffDelete, "a"}, {DiffInsert, "1234"}, {DiffEqual, "xyz"}}, 2, 5}, |
| 1214 | {"Translation on deletion", []Diff{{DiffEqual, "a"}, {DiffDelete, "1234"}, {DiffEqual, "xyz"}}, 3, 1}, |
| 1215 | } { |
| 1216 | actual := dmp.DiffXIndex(tc.Diffs, tc.Location) |
| 1217 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name)) |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | func TestDiffLevenshtein(t *testing.T) { |
| 1222 | type TestCase struct { |
nothing calls this directly
no test coverage detected