Skip to content

Commit

Permalink
Merge pull request #10029 from JuliaLang/mb/intsetequality
Browse files Browse the repository at this point in the history
Fix off-by-one error in ==(s1::IntSet, s2::IntSet)
  • Loading branch information
mbauman committed Feb 2, 2015
2 parents 1814bba + 2e31f5e commit 56e69e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/intset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function ==(s1::IntSet, s2::IntSet)
end
end
else
for i = lim1:lim2
for i = lim1+1:lim2
if s2.bits[i] != filln
return false
end
Expand Down
4 changes: 4 additions & 0 deletions test/sets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ setdiff!(s2, IntSet([2, 4, 5, 6]))

@test s2 == IntSet([1, 3])

# == with last-bit set (groups.google.com/forum/#!topic/julia-users/vZNjiIEG_sY)
s = IntSet(255)
@test s == s

# issue #7851
@test_throws ArgumentError IntSet(-1)
@test !(-1 in IntSet(0:10))
Expand Down

0 comments on commit 56e69e2

Please sign in to comment.