Skip to content

Commit

Permalink
fix str reuse error
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins committed Sep 22, 2017
1 parent 1f68cb5 commit 5ef8121
Showing 1 changed file with 54 additions and 54 deletions.
108 changes: 54 additions & 54 deletions test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -535,64 +535,64 @@ end

let
strs = Any["∀α>β:α+1>β", GenericString("∀α>β:α+1>β")]
for str in strs
@test prevind(str, 1) == 0
@test prevind(str, 1, 1) == 0
@test prevind(str, 2) == 1
@test prevind(str, 2, 1) == 1
@test prevind(str, 4) == 1
@test prevind(str, 4, 1) == 1
@test prevind(str, 5) == 4
@test prevind(str, 5, 1) == 4
@test prevind(str, 5, 2) == 1
@test prevind(str, 5, 3) == 0
@test prevind(str, 15) == 14
@test prevind(str, 15, 1) == 14
@test prevind(str, 15, 2) == 13
@test prevind(str, 15, 3) == 12
@test prevind(str, 15, 4) == 10
@test prevind(str, 15, 10) == 0
@test prevind(str, 15, 9) == 1
@test prevind(str, 15, 10) == 0
@test prevind(str, 16) == 15
@test prevind(str, 16, 1) == 15
@test prevind(str, 16, 2) == 14
@test prevind(str, 20) == 15
@test prevind(str, 20, 1) == 15
@test prevind(str, 20, 10) == 1
@test_throws ArgumentError prevind(str, 20, 0)

@test nextind(str, -1) == 1
@test nextind(str, -1, 1) == 1
@test nextind(str, 0, 2) == 4
@test nextind(str, 0, 20) == 26
@test nextind(str, 0, 10) == 15
@test nextind(str, 1) == 4
@test nextind(str, 1, 1) == 4
@test nextind(str, 1, 2) == 6
@test nextind(str, 1, 9) == 15
@test nextind(str, 1, 10) == 17
@test nextind(str, 2) == 4
@test nextind(str, 2, 1) == 4
@test nextind(str, 3) == 4
@test nextind(str, 3, 1) == 4
@test nextind(str, 4) == 6
@test nextind(str, 4, 1) == 6
@test nextind(str, 14) == 15
@test nextind(str, 14, 1) == 15
@test nextind(str, 15) == 17
@test nextind(str, 15, 1) == 17
@test nextind(str, 20) == 21
@test nextind(str, 20, 1) == 21
@test_throws ArgumentError nextind(str, 20, 0)
for i in 1:2
@test prevind(strs[i], 1) == 0
@test prevind(strs[i], 1, 1) == 0
@test prevind(strs[i], 2) == 1
@test prevind(strs[i], 2, 1) == 1
@test prevind(strs[i], 4) == 1
@test prevind(strs[i], 4, 1) == 1
@test prevind(strs[i], 5) == 4
@test prevind(strs[i], 5, 1) == 4
@test prevind(strs[i], 5, 2) == 1
@test prevind(strs[i], 5, 3) == 0
@test prevind(strs[i], 15) == 14
@test prevind(strs[i], 15, 1) == 14
@test prevind(strs[i], 15, 2) == 13
@test prevind(strs[i], 15, 3) == 12
@test prevind(strs[i], 15, 4) == 10
@test prevind(strs[i], 15, 10) == 0
@test prevind(strs[i], 15, 9) == 1
@test prevind(strs[i], 15, 10) == 0
@test prevind(strs[i], 16) == 15
@test prevind(strs[i], 16, 1) == 15
@test prevind(strs[i], 16, 2) == 14
@test prevind(strs[i], 20) == 15
@test prevind(strs[i], 20, 1) == 15
@test prevind(strs[i], 20, 10) == 1
@test_throws ArgumentError prevind(strs[i], 20, 0)

@test nextind(strs[i], -1) == 1
@test nextind(strs[i], -1, 1) == 1
@test nextind(strs[i], 0, 2) == 4
@test nextind(strs[i], 0, 20) == 26
@test nextind(strs[i], 0, 10) == 15
@test nextind(strs[i], 1) == 4
@test nextind(strs[i], 1, 1) == 4
@test nextind(strs[i], 1, 2) == 6
@test nextind(strs[i], 1, 9) == 15
@test nextind(strs[i], 1, 10) == 17
@test nextind(strs[i], 2) == 4
@test nextind(strs[i], 2, 1) == 4
@test nextind(strs[i], 3) == 4
@test nextind(strs[i], 3, 1) == 4
@test nextind(strs[i], 4) == 6
@test nextind(strs[i], 4, 1) == 6
@test nextind(strs[i], 14) == 15
@test nextind(strs[i], 14, 1) == 15
@test nextind(strs[i], 15) == 17
@test nextind(strs[i], 15, 1) == 17
@test nextind(strs[i], 20) == 21
@test nextind(strs[i], 20, 1) == 21
@test_throws ArgumentError nextind(strs[i], 20, 0)

for x in -10:20
n = p = x
for i in 1:40
p = prevind(str, p)
@test prevind(str, x, i) == p
n = nextind(str, n)
@test nextind(str, x, i) == n
p = prevind(strs[i], p)
@test prevind(strs[i], x, i) == p
n = nextind(strs[i], n)
@test nextind(strs[i], x, i) == n
end
end
end
Expand Down

0 comments on commit 5ef8121

Please sign in to comment.