-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.jl
35 lines (30 loc) · 999 Bytes
/
tests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using BenchmarkTools
using Test
using Traceur
# tests for levenshtein distance
using Random
using REPL
function compare(seq₁::AbstractString, seq₂::AbstractString)::Bool
got = levendist(seq₁, seq₂)
correct = REPL.levenshtein(seq₁, seq₂)
if got != correct
@show got, correct
return false
end
return true
end
@test compare("αjosittingse", "[jokittense")
@test compare("josittingse", "jokittense")
@test compare("kitten", "sitting")
@test compare("azamat", "")
@test compare("azamat", "aza")
@test compare("aza", "tamaza")
@test compare("azamat", "azabemat")
@test compare("azabemat", "c")
@test compare("rosettacode", "raisethysword")
@test compare("azabemat", "b")
@test compare("Saturday", "Sunday")
@test compare("kittenaaaaaaaaaaaaaaaaa", "kitten")
seqlenrng = 1:1000
all(compare(randstring.(rand.((seqlenrng, seqlenrng)))...) for _ ∈ seqlenrng)
@test batch_targets([[1, 3, 5], [3, 1], [4, 2, 2, 3]]) == [[1, 64, 126], [3, 62, 124], [5, 124], [125]]