Skip to content

Commit eaef85a

Browse files
committed
include more tests
1 parent f34938f commit eaef85a

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

test/blockmap.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,9 @@ using LinearMaps: FiveArg
290290
@test mul!(copy(v), LinearMap(transform(L)), u, α, β) transform(M)*u*α + v*β
291291
if transform != adjoint
292292
transL = transform(L)
293-
alloc = @allocated similar(v)
294-
if L == L2 && α != false
295-
@test_broken (@allocated mul!(v, transL, u, α, β)) <= alloc
296-
else
297-
@test (@allocated mul!(v, transL, u, α, β)) <= alloc
298-
end
293+
similar(v)
294+
alloc = @allocations similar(v)
295+
@test (@allocations mul!(v, transL, u, α, β)) <= alloc broken=(L == L2 && α != false)
299296
end
300297
end
301298
end

test/functionmap.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ using Test, LinearMaps, LinearAlgebra
8787
@test mul!(copy(v), LinearMap(transform(CS!)), u, α, β) transform(M)*u*α + v*β
8888
if transform != transpose
8989
transCS! = transform(CS!)
90-
alloc = @allocated similar(v)
91-
@test (@allocated mul!(v, transCS!, u, α, β)) <= alloc
90+
alloc = @allocations similar(v)
91+
@test (@allocations mul!(v, transCS!, u, α, β)) <= alloc + 1
9292
end
9393
end
9494
end

test/linearcombination.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ using LinearMaps: FiveArg, LinearMapTuple, LinearMapVector, FunctionMap
1212
mul!(u, CS!, v)
1313
@test (@allocated mul!(u, CS!, v)) == 0
1414
n = 10
15-
alloc = @allocated similar(v)
15+
alloc = (@allocations similar(v)) + 1
1616
Loop = @inferred CS + CS + CS
1717
@test Loop * v 3cumsum(v)
1818
@test (CS + CR + CS) * v 3cumsum(v)
19-
@test (@allocated Loop * v) <= 3alloc
19+
@test (@allocations Loop * v) <= 3alloc
2020
Loop = @inferred CS + CS; Loop * v
21-
@test (@allocated Loop * v) <= 2alloc
21+
@test (@allocations Loop * v) <= 2alloc
2222
Lmix = @inferred CS + CS + CS!; Lmix * v
23-
@test (@allocated Lmix * v) <= 3alloc
23+
@test (@allocations Lmix * v) <= 3alloc
2424
Lmix = @inferred CS + CS + CS!; Lmix * v
25-
@test (@allocated Lmix * v) <= 3alloc
25+
@test (@allocations Lmix * v) <= 3alloc
2626
Lmix = @inferred CS! + (CS + CS); Lmix * v
27-
@test (@allocated Lmix * v) <= 3alloc
27+
@test (@allocations Lmix * v) <= 3alloc
2828
L = @inferred sum(ntuple(_ -> CS!, n))
2929
@test (@inferred sum(L.maps::LinearMapTuple)) == L
3030
Lv = @inferred LinearMaps.LinearCombination{ComplexF64}(fill(CS!, n))
@@ -60,11 +60,11 @@ using LinearMaps: FiveArg, LinearMapTuple, LinearMapVector, FunctionMap
6060
@test occursin("10×10 $LinearMaps.LinearCombination{$(eltype(L))}", sprint((t, s) -> show(t, "text/plain", s), L+CS!))
6161
@test mul!(u, L, v) n * cumsum(v)
6262
@test mul!(u, Lv, v) n * cumsum(v)
63-
alloc = @allocated similar(u)
63+
alloc = (@allocations similar(u)) + 1
6464
mul!(u, L, v, 2, 2)
65-
@test (@allocated mul!(u, L, v, 2, 2)) <= alloc
65+
@test (@allocations mul!(u, L, v, 2, 2)) <= alloc
6666
mul!(u, Lv, v, 2, 2)
67-
@test (@allocated mul!(u, Lv, v, 2, 2)) <= alloc
67+
@test (@allocations mul!(u, Lv, v, 2, 2)) <= alloc
6868
for α in (false, true, rand(ComplexF64)), β in (false, true, rand(ComplexF64))
6969
for transform in (identity, adjoint, transpose)
7070
@test mul!(copy(u), transform(L), v, α, β) transform(M)*v*α + u*β

0 commit comments

Comments
 (0)