Skip to content

Commit 2e0decb

Browse files
committed
tests: Add copyto! tests
1 parent 776facc commit 2e0decb

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Diff for: test/array/copies.jl

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function test_copyto(sz, partA, partB, T)
2+
A = rand(T, sz...)
3+
DA = distribute(A, partA)
4+
DB = zeros(partB, T, sz...)
5+
copyto!(DB, DA)
6+
@test collect(DB) == collect(DA) == A
7+
end
8+
9+
@testset "T=$T" for T in (Int8, Int32, Int64, Float64, ComplexF64)
10+
test_copyto((128, 128), Blocks(32, 32), Blocks(32, 32), T)
11+
end
12+
sizes_to_test = [
13+
(3, 7),
14+
(32, 16),
15+
(32, 32),
16+
(57, 83),
17+
(128, 128)
18+
]
19+
parts_to_test = map(sz->Blocks(sz...), sizes_to_test)
20+
@testset "Partitioning=$partB<-$partA ($sz)" for partB in parts_to_test, partA in parts_to_test, sz in sizes_to_test
21+
test_copyto(sz, partA, partB, Float64)
22+
end

Diff for: test/runtests.jl

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ tests = [
1212
("Datadeps", "datadeps.jl"),
1313
("Domain Utilities", "domain.jl"),
1414
("Array - Core", "array/core.jl"),
15+
("Array - Copies", "array/copies.jl"),
1516
("Array - MapReduce", "array/mapreduce.jl"),
1617
("Array - LinearAlgebra - Matmul", "array/linalg/matmul.jl"),
1718
("Array - LinearAlgebra - Cholesky", "array/linalg/cholesky.jl"),

0 commit comments

Comments
 (0)