(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func TestDiffCommonPrefix(t *testing.T) { |
| 64 | type TestCase struct { |
| 65 | Name string |
| 66 | |
| 67 | Text1 string |
| 68 | Text2 string |
| 69 | |
| 70 | Expected int |
| 71 | } |
| 72 | |
| 73 | dmp := New() |
| 74 | |
| 75 | for i, tc := range []TestCase{ |
| 76 | {"Null", "abc", "xyz", 0}, |
| 77 | {"Non-null", "1234abcdef", "1234xyz", 4}, |
| 78 | {"Whole", "1234", "1234xyz", 4}, |
| 79 | } { |
| 80 | actual := dmp.DiffCommonPrefix(tc.Text1, tc.Text2) |
| 81 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name)) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | func BenchmarkDiffCommonPrefix(b *testing.B) { |
| 86 | s := "ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ" |
nothing calls this directly
no test coverage detected