add tests and tag new version

main v0.11.3
Matthieu Gomez 2024-04-07 18:44:01 -04:00
parent b7dd39f5e7
commit d47e43a757
2 changed files with 16 additions and 2 deletions

View File

@ -1,6 +1,6 @@
name = "StringDistances"
uuid = "88034a9c-02f8-509d-84a9-84ec65e18404"
version = "0.11.2"
version = "0.11.3"
[deps]
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"

View File

@ -1,5 +1,5 @@
using StringDistances, Unicode, Test
using StringDistances, Unicode, Random, Test
@testset "Modifiers" begin
# Partial
@ -150,4 +150,18 @@ end
@test findall("New York", skipmissing(["NewYork", "Newark", missing]), Levenshtein()) == [1]
@test findall("New York", skipmissing(Union{AbstractString, Missing}[missing, missing]), Levenshtein()) == []
end
Random.seed!(2)
y = map(Random.randstring, rand(5:25,1_000))
x = Random.randstring(10)
for dist in (Levenshtein(), OptimalStringAlignment(), QGram(2), Partial(OptimalStringAlignment()), TokenMax(OptimalStringAlignment()))
result = [compare(x, y, dist) for y in y]
@test findnearest(x, y, dist)[2] == findmax(result)[2]
@test findall(x, y, dist; min_score = 0.4) == findall(result .>= 0.4)
end
end