(t *testing.T)
| 198 | } |
| 199 | |
| 200 | func TestDiffCommonOverlap(t *testing.T) { |
| 201 | type TestCase struct { |
| 202 | Name string |
| 203 | |
| 204 | Text1 string |
| 205 | Text2 string |
| 206 | |
| 207 | Expected int |
| 208 | } |
| 209 | |
| 210 | dmp := New() |
| 211 | |
| 212 | for i, tc := range []TestCase{ |
| 213 | {"Null", "", "abcd", 0}, |
| 214 | {"Whole", "abc", "abcd", 3}, |
| 215 | {"Null", "123456", "abcd", 0}, |
| 216 | {"Null", "123456xxx", "xxxabcd", 3}, |
| 217 | // Some overly clever languages (C#) may treat ligatures as equal to their component letters, e.g. U+FB01 == 'fi' |
| 218 | {"Unicode", "fi", "\ufb01i", 0}, |
| 219 | } { |
| 220 | actual := dmp.DiffCommonOverlap(tc.Text1, tc.Text2) |
| 221 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name)) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | func TestDiffHalfMatch(t *testing.T) { |
| 226 | type TestCase struct { |
nothing calls this directly
no test coverage detected