Skip to content

Commit

Permalink
Add more test.
Browse files Browse the repository at this point in the history
  • Loading branch information
N5N3 committed May 12, 2022
1 parent b912370 commit eebdd2e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ end
@test B == A
end
let A = reshape(1:6, 3, 2), B = zeros(8,8)
RA = CartesianIndices(axes(A))
copyto!(B, CartesianIndices((5:7,2:3)), A, RA)
@test B[5:7,2:3] == A
B[5:7,2:3] .= 0
@test all(x->x==0, B)
copyto!(B, CartesianIndices((3:2:7,1:2:3)), A, RA)
@test B[3:2:7,1:2:3] == A
copyto!(B, CartesianIndices((7:-1:5,3:-1:2)), A, CartesianIndices(map(reverse, axes(A))))
@test B[5:7,2:3] == A
RBs = Any[(5:7,2:3), (3:2:7,1:2:3), (6:-1:4,2:-1:1)]
RAs = Any[axes(A), reverse.(axes(A))]
for RB in RBs, RA in RAs
copyto!(B, CartesianIndices(RB), A, CartesianIndices(RA))
display(B)
@test B[RB...] == A[RA...]
B[RB...] .= 0
@test all(iszero, B)
end
end
end

Expand Down

0 comments on commit eebdd2e

Please sign in to comment.