(t *testing.T)
| 93 | } |
| 94 | |
| 95 | func TestCommonPrefixLength(t *testing.T) { |
| 96 | type TestCase struct { |
| 97 | Text1 string |
| 98 | Text2 string |
| 99 | |
| 100 | Expected int |
| 101 | } |
| 102 | |
| 103 | for i, tc := range []TestCase{ |
| 104 | {"abc", "xyz", 0}, |
| 105 | {"1234abcdef", "1234xyz", 4}, |
| 106 | {"1234", "1234xyz", 4}, |
| 107 | } { |
| 108 | actual := commonPrefixLength([]rune(tc.Text1), []rune(tc.Text2)) |
| 109 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc)) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | func TestDiffCommonSuffix(t *testing.T) { |
| 114 | type TestCase struct { |
nothing calls this directly
no test coverage detected