(t *testing.T)
| 1174 | } |
| 1175 | |
| 1176 | func 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 | |
| 1197 | func TestDiffLevenshtein(t *testing.T) { |
| 1198 | type TestCase struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…