-
Notifications
You must be signed in to change notification settings - Fork 87
Minor test improvements #638
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
Conversation
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/test/testsuite/linalg.jl b/test/testsuite/linalg.jl
index b042d94..00332bd 100644
--- a/test/testsuite/linalg.jl
+++ b/test/testsuite/linalg.jl
@@ -1,4 +1,4 @@
-@testsuite "linalg/core " (AT, eltypes)->begin
+@testsuite "linalg/core " (AT, eltypes) -> begin
@testset "adjoint and transpose" begin
@test compare(adjoint, AT, rand(Float32, 32, 32))
@test compare(adjoint!, AT, rand(Float32, 32, 32), rand(Float32, 32, 32))
@@ -23,12 +23,12 @@
@test compare(x -> permutedims(x, (2, 1, 3)), AT, rand(Float32, 4, 5, 6))
@test compare(x -> permutedims(x, (3, 1, 2)), AT, rand(Float32, 4, 5, 6))
if ComplexF32 in eltypes
- @test compare(x -> permutedims(x, [2,1,4,3]), AT, randn(ComplexF32,3,4,5,1))
+ @test compare(x -> permutedims(x, [2, 1, 4, 3]), AT, randn(ComplexF32, 3, 4, 5, 1))
# test UInt64 version to make sure it works properly when array length is larger than typemax of UInt32.
AT <: GPUArrays.AbstractGPUArray && @test let
- x = randn(ComplexF32,3,4,5,1)
- y = permutedims(x, (2,1,4,3))
- Array(GPUArrays._permutedims!(UInt64, AT(zero(y)), AT(x), (2,1,4,3))) ≈ y
+ x = randn(ComplexF32, 3, 4, 5, 1)
+ y = permutedims(x, (2, 1, 4, 3))
+ Array(GPUArrays._permutedims!(UInt64, AT(zero(y)), AT(x), (2, 1, 4, 3))) ≈ y
end
end
# high dimensional tensor
@@ -76,8 +76,8 @@
continue
end
n = 128
- areal = randn(n,n)/2
- aimg = randn(n,n)/2
+ areal = randn(n, n) / 2
+ aimg = randn(n, n) / 2
a = convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal)
@test compare(x -> LinearAlgebra.copytri!(x, uplo, conjugate), AT, a)
end
@@ -354,7 +354,7 @@
end
@testset "lmul! and rmul!" begin
- @testset "$T ($a,$b)" for (a,b) in [((3,4),(4,3)), ((3,), (1,3)), ((1,3), (3))], T in eltypes
+ @testset "$T ($a,$b)" for (a, b) in [((3, 4), (4, 3)), ((3,), (1, 3)), ((1, 3), (3))], T in eltypes
@test compare(rmul!, AT, rand(T, a), Ref(rand(T)))
@test compare(lmul!, AT, Ref(rand(T)), rand(T, b))
end
@@ -362,26 +362,26 @@
@testset "axp{b}y" begin
@testset "$T" for T in eltypes
- @test compare(axpby!, AT, Ref(rand(T)), rand(T,5), Ref(rand(T)), rand(T,5))
- @test compare(axpy!, AT, Ref(rand(T)), rand(T,5), rand(T,5))
+ @test compare(axpby!, AT, Ref(rand(T)), rand(T, 5), Ref(rand(T)), rand(T, 5))
+ @test compare(axpy!, AT, Ref(rand(T)), rand(T, 5), rand(T, 5))
end
end
@testset "dot" begin
@testset "$T" for T in eltypes
- @test compare(dot, AT, rand(T,5), rand(T, 5))
+ @test compare(dot, AT, rand(T, 5), rand(T, 5))
end
end
@testset "rotate!" begin
@testset "$T" for T in eltypes
- @test compare(rotate!, AT, rand(T,5), rand(T,5), Ref(rand(real(T))), Ref(rand(T)))
+ @test compare(rotate!, AT, rand(T, 5), rand(T, 5), Ref(rand(real(T))), Ref(rand(T)))
end
end
@testset "reflect!" begin
@testset "$T" for T in eltypes
- @test compare(reflect!, AT, rand(T,5), rand(T,5), Ref(rand(real(T))), Ref(rand(T)))
+ @test compare(reflect!, AT, rand(T, 5), rand(T, 5), Ref(rand(real(T))), Ref(rand(T)))
end
end
|
This comment was marked as outdated.
This comment was marked as outdated.
|
I pushed the improvements I mentioned I'd add. Now that errors are properly displayed in testset results, a failure in After this PR, it'll look like this: |
|
I added one last PR. This is definitely ready for review, the only changes I'll be making are fixes/review comments |
Minor changes but with this change we'll be able to run the
gpuarrays/linalgtestset without running all the other testsets that start withgpuarrays/linalg.Also slightly refactors the structure of the tests in linalg so that the output is formatted better when a test fails.