Skip to content

Commit a4a2a21

Browse files
committed
Improve output when erroring
1 parent 2f6b42e commit a4a2a21

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

test/testsuite/linalg.jl

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
end
227227

228228
@testset "mul! + Diagonal" begin
229-
for elty in (Float32, ComplexF32)
229+
@testset "$elty" for elty in (Float32, ComplexF32)
230230
n = 128
231231
d = AT(rand(elty, n))
232232
D = Diagonal(d)
@@ -303,43 +303,53 @@
303303
end
304304
end
305305

306-
@testset "lmul! and rmul!" for (a,b) in [((3,4),(4,3)), ((3,), (1,3)), ((1,3), (3))], T in eltypes
307-
@test compare(rmul!, AT, rand(T, a), Ref(rand(T)))
308-
@test compare(lmul!, AT, Ref(rand(T)), rand(T, b))
306+
@testset "lmul! and rmul!" begin
307+
@testset "$T ($a,$b)" for (a,b) in [((3,4),(4,3)), ((3,), (1,3)), ((1,3), (3))], T in eltypes
308+
@test compare(rmul!, AT, rand(T, a), Ref(rand(T)))
309+
@test compare(lmul!, AT, Ref(rand(T)), rand(T, b))
310+
end
309311
end
310312

311-
@testset "axp{b}y" for T in eltypes
312-
@test compare(axpby!, AT, Ref(rand(T)), rand(T,5), Ref(rand(T)), rand(T,5))
313-
@test compare(axpy!, AT, Ref(rand(T)), rand(T,5), rand(T,5))
313+
@testset "axp{b}y" begin
314+
@testset "$T" for T in eltypes
315+
@test compare(axpby!, AT, Ref(rand(T)), rand(T,5), Ref(rand(T)), rand(T,5))
316+
@test compare(axpy!, AT, Ref(rand(T)), rand(T,5), rand(T,5))
317+
end
314318
end
315319

316-
@testset "dot" for T in eltypes
317-
@test compare(dot, AT, rand(T,5), rand(T, 5))
320+
@testset "dot" begin
321+
@testset "$T" for T in eltypes
322+
@test compare(dot, AT, rand(T,5), rand(T, 5))
323+
end
318324
end
319325

320-
@testset "rotate!" for T in eltypes
321-
@test compare(rotate!, AT, rand(T,5), rand(T,5), Ref(rand(real(T))), Ref(rand(T)))
326+
@testset "rotate!" begin
327+
@testset "$T" for T in eltypes
328+
@test compare(rotate!, AT, rand(T,5), rand(T,5), Ref(rand(real(T))), Ref(rand(T)))
329+
end
322330
end
323331

324-
@testset "reflect!" for T in eltypes
325-
@test compare(reflect!, AT, rand(T,5), rand(T,5), Ref(rand(real(T))), Ref(rand(T)))
332+
@testset "reflect!" begin
333+
@testset "$T" for T in eltypes
334+
@test compare(reflect!, AT, rand(T,5), rand(T,5), Ref(rand(real(T))), Ref(rand(T)))
335+
end
326336
end
327337

328-
@testset "iszero and isone" for T in eltypes
329-
A = one(AT(rand(T, 2, 2)))
330-
@test isone(A)
331-
@test iszero(A) == false
338+
@testset "iszero and isone" begin
339+
@testset "$T" for T in eltypes
340+
A = one(AT(rand(T, 2, 2)))
341+
@test isone(A)
342+
@test iszero(A) == false
332343

333-
A = zero(AT(rand(T, 2, 2)))
334-
@test iszero(A)
335-
@test isone(A) == false
344+
A = zero(AT(rand(T, 2, 2)))
345+
@test iszero(A)
346+
@test isone(A) == false
347+
end
336348
end
337349

338350
@testset "kron" begin
339-
@testset "$T" for T in eltypes
340-
for opa in (vec, identity, transpose, adjoint), opb in (vec, identity, transpose, adjoint)
341-
@test compare(kron, AT, opa(rand(T, 32, 64)), opb(rand(T, 128, 16)))
342-
end
351+
@testset "$T, $opa, $opb" for T in eltypes, opa in (vec, identity, transpose, adjoint), opb in (vec, identity, transpose, adjoint)
352+
@test compare(kron, AT, opa(rand(T, 32, 64)), opb(rand(T, 128, 16)))
343353
end
344354
end
345355
end

0 commit comments

Comments
 (0)