diff --git a/.travis.yml b/.travis.yml index a51a144..68d3881 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,11 @@ sudo: false matrix: fast_finish: true include: - - go: 1.11.x + - go: 1.14.x env: TEST_METHOD=goveralls + - go: 1.13.x + - go: 1.12.x + - go: 1.11.x - go: 1.10.x - go: tip - go: 1.9.x @@ -14,6 +17,8 @@ matrix: - go: 1.5.x allow_failures: - go: tip + - go: 1.11.x + - go: 1.10.x - go: 1.9.x - go: 1.8.x - go: 1.7.x diff --git a/README.md b/README.md index 9e42558..d9a8ce1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This package implements distance and similarity metrics for strings, based on th ## Project Status -v1.2.2 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis. +v1.2.3 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis. This package is being actively maintained. If you encounter any problems or have any suggestions for improvement, please [open an issue](https://github.com/agext/levenshtein/issues). Pull requests are welcome. diff --git a/levenshtein.go b/levenshtein.go index df69ce7..56d719b 100644 --- a/levenshtein.go +++ b/levenshtein.go @@ -108,7 +108,7 @@ func Calculate(str1, str2 []rune, maxCost, insCost, subCost, delCost int) (dist, for x := 0; x < l2; x++ { dy, d[doff] = d[doff], d[doff]+insCost - for d[doff] > maxCost && dlen > 0 { + for doff < l1 && d[doff] > maxCost && dlen > 0 { if str1[doff] != str2[x] { dy += subCost } diff --git a/levenshtein_test.go b/levenshtein_test.go index 7a16548..bc6bf73 100644 --- a/levenshtein_test.go +++ b/levenshtein_test.go @@ -141,6 +141,8 @@ func Test_Metrics(t *testing.T) { {"password", "pass1", "(minScore=0.6)", NewParams().MinScore(.6), e{4, 4, 0, 0, 0}}, {"password", "pass1wor", "(minScore=0.9)", NewParams().MinScore(.9), e{2, 4, 0, 0, 0}}, {"password", "password", "(minScore=1.1)", NewParams().MinScore(1.1), e{0, 8, 0, 0, 0}}, + {"NetworkManager-glib-0.8.1-5.el6_0.1.i686.rpm", "NetworkManager-glib-0.9.3-15.el6_0.1.i686.rpm", "(minScore=0.92)", NewParams().MinScore(0.92), e{3, 22, 18, 42. / 45, 43.2 / 45}}, + {"NetworkManager-glib-0.8.1-5.el6_0.1.i686.rpm", "gdm-plugin-fingerprint-2.30.4-39.el6.i686.rpm", "(minScore=0.92)", NewParams().MinScore(0.92), e{28, 0, 9, 0, 0}}, // The rest of these are miscellaneous examples. They will // be illustrated using the following key: