Skip to content

Commit c278627

Browse files
committed
Improve @testset handling
1 parent ed3a934 commit c278627

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

test/testOperators.jl

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function testDCT1d(N=32;arrayType = Array)
2424

2525
x2 = adjoint(D3)*y3
2626
@test norm(x2 - x) / norm(x) 0 atol=0.01
27-
true
2827
end
2928

3029
function testFFT1d(N=32,shift=true;arrayType = Array)
@@ -52,7 +51,6 @@ function testFFT1d(N=32,shift=true;arrayType = Array)
5251
x2 = adjoint(D2)*y2
5352
end
5453
@test norm(x1 - x2) / norm(x1) 0 atol=0.01
55-
true
5654
end
5755

5856
function testFFT2d(N=32,shift=true;arrayType = Array)
@@ -84,7 +82,6 @@ function testFFT2d(N=32,shift=true;arrayType = Array)
8482
x2 = adjoint(D2)*y2
8583
end
8684
@test norm(x1 - x2) / norm(x1) 0 atol=0.01
87-
true
8885
end
8986

9087
function testWeighting(N=512;arrayType = Array)
@@ -103,7 +100,6 @@ function testWeighting(N=512;arrayType = Array)
103100
y = repeat(weights,2) .* x2
104101

105102
@test norm(Array(y2) - y) / norm(y) 0 atol=0.01
106-
true
107103
end
108104

109105
function testGradOp1d(N=512;arrayType = Array)
@@ -120,7 +116,6 @@ function testGradOp1d(N=512;arrayType = Array)
120116
xr0 = transpose(G0)*y0
121117

122118
@test norm(xr - xr0) / norm(xr0) 0 atol=0.001
123-
true
124119
end
125120

126121
function testGradOp2d(N=64;arrayType = Array)
@@ -140,7 +135,6 @@ function testGradOp2d(N=64;arrayType = Array)
140135
xr0 = vec(xr0)
141136

142137
@test norm(xr - xr0) / norm(xr0) 0 atol=0.001
143-
true
144138
end
145139

146140
function testDirectionalGradOp(N=64;arrayType = Array)
@@ -173,7 +167,6 @@ function testDirectionalGradOp(N=64;arrayType = Array)
173167
end
174168
@test norm(x1r-vec(x1r_ref)) / norm(x1r_ref) 0 atol=0.001
175169
@test norm(x2r-vec(x2r_ref)) / norm(x2r_ref) 0 atol=0.001
176-
true
177170
end
178171

179172
function testSampling(N=64;arrayType = Array)
@@ -196,7 +189,6 @@ function testSampling(N=64;arrayType = Array)
196189
@test norm(y - y_ref) / norm(y_ref) 0 atol=0.000001
197190
@test norm(x2 - x2_ref) / norm(x2_ref) 0 atol=0.000001
198191
@test norm(y2 - x2_ref) / norm(x2_ref) 0 atol=0.000001
199-
true
200192
end
201193

202194
function testWavelet(M=64,N=60;arrayType = Array)
@@ -208,7 +200,6 @@ function testWavelet(M=64,N=60;arrayType = Array)
208200
x_reco = reshape( adjoint(WOp)*x_wavelet, M, N)
209201

210202
@test norm(x_reco - x) / norm(x) 0 atol=0.001
211-
true
212203
end
213204

214205
# test FourierOperators
@@ -265,7 +256,6 @@ function testNFFT2d(N=16;arrayType = Array)
265256

266257
@test Complex{eltype(nodes)} === eltype(y_nfft)
267258
@test Complex{eltype(nodes)} === eltype(y_adj_nfft)
268-
true
269259
end
270260

271261
function testNFFT3d(N=12;arrayType = Array)
@@ -310,7 +300,6 @@ function testNFFT3d(N=12;arrayType = Array)
310300
y_AHA = F' * F * vec(x)
311301
@test y_AHA_nfft_1 y_AHA_nfft_2 rtol = 1e-2
312302
@test y_AHA y_AHA_nfft_1 rtol = 1e-2
313-
true
314303
end
315304

316305
function testDiagOp(N=32,K=2;arrayType = Array)
@@ -374,7 +363,6 @@ function testDiagOp(N=32,K=2;arrayType = Array)
374363
@test y2 y3 rtol = 1e-2
375364
end
376365

377-
true
378366
end
379367

380368
function testRadonOp(N=32;arrayType = Array)
@@ -392,39 +380,38 @@ function testRadonOp(N=32;arrayType = Array)
392380
xtmp = Array(backproject(arrayType(y), angles; geometry = geom))
393381
x2 = reshape(Array(adjoint(op) * arrayType(vec(y1))), size(xtmp)...)
394382
@test xtmp x2 rtol = 1e-2
395-
true
396383
end
397384

398385
@testset "Linear Operators" begin
399386
@testset for arrayType in arrayTypes
400387
@info "test DCT-II and DCT-IV Ops: $arrayType"
401388
for N in [2,8,16,32]
402-
@test testDCT1d(N;arrayType) skip = arrayType != Array # Not implemented for GPUs
389+
arrayType != Array || @testset testDCT1d(N;arrayType) # Not implemented for GPUs
403390
end
404391
@info "test FFTOp: $arrayType"
405392
for N in [8,16,32]
406-
@test testFFT1d(N,false;arrayType)
407-
@test testFFT1d(N,true;arrayType)
408-
@test testFFT2d(N,false;arrayType)
409-
@test testFFT2d(N,true;arrayType)
393+
@testset testFFT1d(N,false;arrayType)
394+
@testset testFFT1d(N,true;arrayType)
395+
@testset testFFT2d(N,false;arrayType)
396+
@testset testFFT2d(N,true;arrayType)
410397
end
411398
@info "test WeightingOp: $arrayType"
412-
@test testWeighting(512;arrayType)
399+
@testset testWeighting(512;arrayType)
413400
@info "test GradientOp: $arrayType"
414-
@test testGradOp1d(512;arrayType)
415-
@test testGradOp2d(64;arrayType)
416-
@test testDirectionalGradOp(64;arrayType)
401+
@testset testGradOp1d(512;arrayType)
402+
@testset testGradOp2d(64;arrayType)
403+
@testset testDirectionalGradOp(64;arrayType)
417404
@info "test SamplingOp: $arrayType"
418-
@test testSampling(64;arrayType)
405+
@testset testSampling(64;arrayType)
419406
@info "test WaveletOp: $arrayType"
420-
@test testWavelet(64,64;arrayType)
421-
@test testWavelet(64,60;arrayType)
407+
@testset testWavelet(64,64;arrayType)
408+
@testset testWavelet(64,60;arrayType)
422409
@info "test NFFTOp: $arrayType"
423-
@test testNFFT2d(;arrayType) skip = arrayType == JLArray # JLArray does not have a NFFTPlan
424-
@test testNFFT3d(;arrayType) skip = arrayType == JLArray # JLArray does not have a NFFTPlan
410+
arrayType == JLArray || @testset testNFFT2d(;arrayType) # JLArray does not have a NFFTPlan
411+
arrayType == JLArray || @testset testNFFT3d(;arrayType) # JLArray does not have a NFFTPlan
425412
@info "test DiagOp: $arrayType"
426-
@test testDiagOp(;arrayType)
413+
@testset testDiagOp(;arrayType)
427414
@info "test RadonOp: $arrayType"
428-
@test testRadonOp(;arrayType) skip = arrayType == JLArray # Stackoverflow for kernelabstraction
415+
arrayType == JLArray || @testset testRadonOp(;arrayType) # Stackoverflow for kernelabstraction
429416
end
430417
end

0 commit comments

Comments
 (0)