(t *testing.T)
| 1219 | } |
| 1220 | |
| 1221 | func TestDiffLevenshtein(t *testing.T) { |
| 1222 | type TestCase struct { |
| 1223 | Name string |
| 1224 | |
| 1225 | Diffs []Diff |
| 1226 | |
| 1227 | Expected int |
| 1228 | } |
| 1229 | |
| 1230 | dmp := New() |
| 1231 | |
| 1232 | for i, tc := range []TestCase{ |
| 1233 | {"Levenshtein with trailing equality", []Diff{{DiffDelete, "абв"}, {DiffInsert, "1234"}, {DiffEqual, "эюя"}}, 4}, |
| 1234 | {"Levenshtein with leading equality", []Diff{{DiffEqual, "эюя"}, {DiffDelete, "абв"}, {DiffInsert, "1234"}}, 4}, |
| 1235 | {"Levenshtein with middle equality", []Diff{{DiffDelete, "абв"}, {DiffEqual, "эюя"}, {DiffInsert, "1234"}}, 7}, |
| 1236 | } { |
| 1237 | actual := dmp.DiffLevenshtein(tc.Diffs) |
| 1238 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name)) |
| 1239 | } |
| 1240 | } |
| 1241 | |
| 1242 | func TestDiffBisect(t *testing.T) { |
| 1243 | type TestCase struct { |
nothing calls this directly
no test coverage detected