Skip to content

Commit fae256a

Browse files
kshyattvchuravy
authored andcommitted
Added tests for similar/reshape
1 parent 5a9ef25 commit fae256a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/darray.jl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,39 @@ end
7171

7272
check_leaks()
7373

74+
@testset "test DArray similar" begin
75+
D = drand((200,200), [MYID, OTHERIDS])
76+
DS = similar(D,Float16)
77+
78+
@testset "test eltype of a similar" begin
79+
@test eltype(DS) == Float16
80+
end
81+
82+
@testset "test dims of a similar" begin
83+
@test size(D) == size(DS)
84+
end
85+
close(D)
86+
close(DS)
87+
end
88+
89+
check_leaks()
90+
91+
@testset "test DArray reshape" begin
92+
D = drand((200,200), [MYID, OTHERIDS])
93+
94+
@testset "Test error-throwing in reshape" begin
95+
@test_throws DimensionMismatch reshape(D,(100,100))
96+
end
97+
98+
DR = reshape(D,(100,400))
99+
@testset "Test reshape" begin
100+
@test size(DR) == (100,400)
101+
end
102+
close(D)
103+
end
104+
105+
check_leaks()
106+
74107
@testset "test @DArray comprehension constructor" begin
75108

76109
@testset "test valid use of @DArray" begin

0 commit comments

Comments
 (0)