Skip to content

Commit

Permalink
Merge pull request #15999 from JuliaLang/teh/faster_subarray_tests
Browse files Browse the repository at this point in the history
Faster subarray tests with ANY
  • Loading branch information
timholy committed Apr 22, 2016
2 parents 9406e88 + eb74d19 commit c204232
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ function single_stride_dim(A::Array)
end
ld
end
single_stride_dim(A::AbstractArray) = single_stride_dim(copy_to_array(A))
single_stride_dim(A::ANY) = single_stride_dim(copy_to_array(A))

# Testing equality of AbstractArrays, using several different methods to access values
function test_cartesian(A, B)
function test_cartesian(A::ANY, B::ANY)
isgood = true
for (IA, IB) in zip(eachindex(A), eachindex(B))
if A[IA] != B[IB]
Expand All @@ -106,7 +106,7 @@ function test_cartesian(A, B)
end
end

function test_linear(A, B)
function test_linear(A::ANY, B::ANY)
length(A) == length(B) || error("length mismatch")
isgood = true
for (iA, iB) in zip(1:length(A), 1:length(B))
Expand All @@ -127,7 +127,7 @@ end
test_mixed{T}(::AbstractArray{T,1}, ::Array) = nothing
test_mixed{T}(::AbstractArray{T,2}, ::Array) = nothing
test_mixed(A, B::Array) = _test_mixed(A, reshape(B, size(A)))
function _test_mixed(A, B)
function _test_mixed(A::ANY, B::ANY)
L = length(A)
m = size(A, 1)
n = div(L, m)
Expand All @@ -146,7 +146,7 @@ function _test_mixed(A, B)
nothing
end

function test_bounds(A)
function test_bounds(A::ANY)
@test_throws BoundsError A[0]
@test_throws BoundsError A[end+1]
@test_throws BoundsError A[1, 0]
Expand Down Expand Up @@ -190,7 +190,7 @@ function runtests(A::Array, I...)
test_bounds(S)
end

function runtests(A::SubArray, I...)
function runtests(A::ANY, I...)
# When A was created with sub, we have to check bounds, since some
# of the "residual" dimensions have size 1. It's possible that we
# need dedicated tests for sub.
Expand Down

0 comments on commit c204232

Please sign in to comment.