Skip to content

Commit

Permalink
Merge pull request #35624 from JuliaLang/mb/test35598
Browse files Browse the repository at this point in the history
More hashing tests for offset arrays
  • Loading branch information
mbauman authored Apr 29, 2020
2 parents 9010b7f + 9d4b33c commit 5a71af3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/hashing.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Random, LinearAlgebra, SparseArrays
isdefined(Main, :OffsetArrays) || @eval Main include("testhelpers/OffsetArrays.jl")
using .Main.OffsetArrays

types = Any[
Bool,
Expand Down Expand Up @@ -93,6 +95,10 @@ vals = Any[
1:4, 1:1:4, 1:-1:0, 1.0:4.0, 1.0:1.0:4.0, range(1, stop=4, length=4),
# issue #35597, when `LinearIndices` does not begin at 1
Base.IdentityUnitRange(2:4),
OffsetArray(1:4, -2),
OffsetArray([1 3; 2 4], -2, 2),
OffsetArray(1:4, 0),
OffsetArray([1 3; 2 4], 0, 0),
'a':'e', ['a', 'b', 'c', 'd', 'e'],
# check that hash is still consistent with heterogeneous arrays for which - is defined
# for some pairs and not others
Expand All @@ -105,8 +111,11 @@ end

for a in vals
a isa AbstractArray || continue
keys(a) == keys(Array(a)) || continue
@test hash(a) == hash(Array(a)) == hash(Array{Any}(a))
if keys(a) == keys(Array(a))
@test hash(a) == hash(Array(a)) == hash(Array{Any}(a))
else
@test hash(a) == hash(OffsetArray(Array(a), (first.(axes(a)).-1)...)) == hash(OffsetArray(Array{Any}(a), (first.(axes(a)).-1)...))
end
end

vals = Any[
Expand Down

2 comments on commit 5a71af3

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.