(t *testing.T)
| 1195 | } |
| 1196 | |
| 1197 | func TestDiffLevenshtein(t *testing.T) { |
| 1198 | type TestCase struct { |
| 1199 | Name string |
| 1200 | |
| 1201 | Diffs []Diff |
| 1202 | |
| 1203 | Expected int |
| 1204 | } |
| 1205 | |
| 1206 | dmp := New() |
| 1207 | |
| 1208 | for i, tc := range []TestCase{ |
| 1209 | {"Levenshtein with trailing equality", []Diff{{DiffDelete, "абв"}, {DiffInsert, "1234"}, {DiffEqual, "эюя"}}, 4}, |
| 1210 | {"Levenshtein with leading equality", []Diff{{DiffEqual, "эюя"}, {DiffDelete, "абв"}, {DiffInsert, "1234"}}, 4}, |
| 1211 | {"Levenshtein with middle equality", []Diff{{DiffDelete, "абв"}, {DiffEqual, "эюя"}, {DiffInsert, "1234"}}, 7}, |
| 1212 | } { |
| 1213 | actual := dmp.DiffLevenshtein(tc.Diffs) |
| 1214 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name)) |
| 1215 | } |
| 1216 | } |
| 1217 | |
| 1218 | func TestDiffBisect(t *testing.T) { |
| 1219 | type TestCase struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…