Skip to content

Commit

Permalink
Merge pull request #6 from timbitz/master
Browse files Browse the repository at this point in the history
tests update and last deprecation warning fix
  • Loading branch information
quinnj authored Jun 5, 2017
2 parents f7d349e + a81d03b commit 1e8cc8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/sais.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ function induceSA(T,SA,C,B,n,k)
for i = n:-1:1
if 0 < (j = SA[i])
j -= 1
if (c0 = T[j+1]) != c1
c0 = T[j+1]
if Int(c0) != Int(c1)
B[Int(c1)+1] = b
c1 = c0
b = B[Int(c1)+1]
Expand Down
18 changes: 9 additions & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Base.Test

function test_suffix(args)
for file in args
T = open(readall,file)
T = open(readstring,file)
tic()
SA = suffixsort(T)
t = toq()
Expand Down Expand Up @@ -33,22 +33,22 @@ function sufcheck(T,SA)
end
end
for i = 1:n
C[T[i]+1] += 1
C[Int(T[i])+1] += 1
end
p = 0
for i = 1:256
t = C[i]
C[i] = p
p += t
end
q = C[T[n]+1]
C[T[n]+1] += 1
q = C[Int(T[n])+1]
C[Int(T[n])+1] += 1
for i = 1:n
p = SA[i]
if 0 < p
p -= 1
c = T[p+1]
t = C[c+1]
t = C[Int(c)+1]
else
p = n-1
c = T[p+1]
Expand All @@ -59,9 +59,9 @@ function sufcheck(T,SA)
return -4
end
if t != q
C[c+1] += 1
if n <= C[c+1] || T[SA[C[c+1]+1]+1] != c
C[c+1] = -1
C[Int(c)+1] += 1
if n <= C[Int(c)+1] || T[SA[C[Int(c)+1]+1]+1] != c
C[Int(c)+1] = -1
end
end
end
Expand All @@ -83,5 +83,5 @@ function walkdir(dir,files)
return unique(files)
end

files = walkdir(dirname(dirname(@__FILE__)),{})
files = walkdir(dirname(dirname(@__FILE__)),[])
test_suffix(files)

0 comments on commit 1e8cc8e

Please sign in to comment.