Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster subarray tests with ANY #15999

Merged
merged 1 commit into from
Apr 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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