Skip to content

Commit 36ba944

Browse files
committed
Perform comparisons on the CPU.
This makes more of the test suite work without a mapreduce implementation.
1 parent f5272f9 commit 36ba944

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

test/testsuite/broadcasting.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ function broadcasting(AT)
5454
@testset "Adjoint and Transpose" begin
5555
A = AT(rand(ET, N))
5656
A' .= ET(2)
57-
@test all(isequal(ET(2)'), A)
57+
@test all(isequal(ET(2)'), Array(A))
5858
transpose(A) .= ET(1)
59-
@test all(isequal(ET(1)), A)
59+
@test all(isequal(ET(1)), Array(A))
6060
end
6161

6262
############

test/testsuite/construction.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ end
146146

147147
@testsuite "iterator constructors" AT->begin
148148
for T in supported_eltypes()
149-
@test AT(Fill(T(0), (10,))) == fill!(similar(AT{T}, (10,)), T(0))
150-
@test AT(Fill(T(0), (10, 10))) == fill!(similar(AT{T}, (10, 10)), T(0))
149+
@test Array(AT(Fill(T(0), (10,)))) == Array(fill!(similar(AT{T}, (10,)), T(0)))
150+
@test Array(AT(Fill(T(0), (10, 10)))) == Array(fill!(similar(AT{T}, (10, 10)), T(0)))
151151
if T <: Real
152152
x = AT{Float32}(Fill(T(0), (10, 10)))
153153
@test eltype(x) == Float32
154-
@test AT(Eye{T}((10))) == AT{T}(I, 10, 10)
154+
@test Array(AT(Eye{T}((10)))) == Array(AT{T}(I, 10, 10))
155155
x = AT{Float32}(Eye{T}(10))
156156
@test eltype(x) == Float32
157157
end

test/testsuite/indexing.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,16 @@ end
8585
@testsuite "indexing multidimensional" AT->begin
8686
@testset "sliced setindex" for T in supported_eltypes()
8787
x = AT(zeros(T, (10, 10, 10, 10)))
88-
y = similar(x, (5, 5, 10, 10))
89-
rand!(y)
88+
y = AT(rand(T, (5, 5, 10, 10)))
9089
x[2:6, 2:6, :, :] = y
9190
@test Array(x[2:6, 2:6, :, :]) == Array(y)
9291
end
9392

9493
@testset "sliced setindex, CPU source" for T in supported_eltypes()
9594
x = AT(zeros(T, (2,3,4)))
96-
y = similar(x, (2,3))
97-
rand!(y)
95+
y = AT(rand(T, (2,3)))
9896
x[:, :, 2] = y
99-
@test x[:, :, 2] == y
97+
@test Array(x[:, :, 2]) == Array(y)
10098
end
10199

102100
@allowscalar @testset "empty array" begin

test/testsuite/random.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
B = copy(A)
88
rand!(A)
99
rand!(B)
10-
@test A != B
10+
@test Array(A) != Array(B)
1111

1212
rng = if AT <: AbstractGPUArray
1313
GPUArrays.default_rng(AT)
@@ -19,7 +19,7 @@
1919
rand!(rng, A)
2020
Random.seed!(rng, 1)
2121
rand!(rng, B)
22-
@test all(A .== B)
22+
@test all(Array(A) .== Array(B))
2323
end
2424

2525
A = AT{Bool}(undef, 5)
@@ -34,7 +34,7 @@
3434
B = copy(A)
3535
randn!(A)
3636
randn!(B)
37-
@test !any(A .== B)
37+
@test !any(Array(A) .== Array(B))
3838

3939
rng = if AT <: AbstractGPUArray
4040
GPUArrays.default_rng(AT)
@@ -46,7 +46,7 @@
4646
randn!(rng, A)
4747
Random.seed!(rng, 1)
4848
randn!(rng, B)
49-
@test all(A .== B)
49+
@test all(Array(A) .== Array(B))
5050
end
5151
end
5252
end

0 commit comments

Comments
 (0)