@@ -143,6 +143,8 @@ function apply_op!(H, du, u, p, t)
143143 return nothing
144144end
145145
146+ test_apply_noalloc (H, du, u, p, t) = @test (@allocations apply_op! (H, du, u, p, t)) == 0
147+
146148@testset " AddedOperator" begin
147149 A = rand (N, N) |> MatrixOperator
148150 B = rand (N, N) |> MatrixOperator
192194
193195 # Allocations Tests
194196
195- allocs_tot = @allocations apply_op! (op, v, u, (), 1.0 ) # warmup
196- allocs_tot = @allocations apply_op! (op, v, u, (), 1.0 )
197- @test allocs_tot <= 1 # BenchmarkTools.jl returns 0 instead of 1
197+ @allocations apply_op! (op, v, u, (), 1.0 ) # warmup
198+ test_apply_noalloc (op, v, u, (), 1.0 )
198199
199200 # # Time-Dependent Coefficients
200201
@@ -224,12 +225,10 @@ end
224225 p = (ω = 0.1 ,)
225226 t = 0.1
226227
227- allocs_sparse = @allocations apply_op! (H_sparse, du, u, p, t) # warmup
228- allocs_sparse = @allocations apply_op! (H_sparse, du, u, p, t)
229- allocs_dense = @allocations apply_op! (H_dense, du, u, p, t) # warmup
230- allocs_dense = @allocations apply_op! (H_dense, du, u, p, t)
231- @test allocs_sparse <= 1 # BenchmarkTools.jl returns 0 instead of 1
232- @test allocs_dense <= 1 # BenchmarkTools.jl returns 0 instead of 1
228+ @allocations apply_op! (H_sparse, du, u, p, t) # warmup
229+ @allocations apply_op! (H_dense, du, u, p, t) # warmup
230+ test_apply_noalloc (H_sparse, du, u, p, t)
231+ test_apply_noalloc (H_dense, du, u, p, t)
233232 end
234233end
235234
0 commit comments