Skip to content

Commit 6871922

Browse files
committed
test on 1.6
1 parent 5dff1ba commit 6871922

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

test/runtests.jl

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -355,23 +355,4 @@ end
355355
@test deserialized == data
356356
end
357357

358-
if VERSION >= v"1.9.0"
359-
360-
@vars x y
361-
a = Basic()
362-
@testset "non-allocating(ish) methods" begin
363-
sin(x), cos(x), abs(x)
364-
x^x, x + x, x*x, x-x, x/x # warm up
365-
366-
@test (@allocations SymEngine.sin!(a,x)) == 0
367-
@test (@allocations SymEngine.cos!(a,x)) == 0
368-
@test (@allocations SymEngine.pow!(a,x,x)) == 0
369-
370-
# still allocates 1 (or 2)
371-
@test (@allocations SymEngine.add!(a,x,y)) < (@allocations x+y)
372-
@test (@allocations SymEngine.sub!(a,x,y)) < (@allocations x-y)
373-
@test (@allocations SymEngine.mul!(a,x,y)) < (@allocations x*y)
374-
@test (@allocations SymEngine.div!(a,x,y)) < (@allocations x/y)
375-
@test (@allocations SymEngine.abs2!(a,x)) < (@allocations abs2(x))
376-
end
377-
end
358+
VERSION >= v"1.9.0" && include("test-allocations.jl")

test/test-allocations.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# test for allocations
2+
@vars x y
3+
a = Basic()
4+
@testset "non-allocating(ish) methods" begin
5+
sin(x), cos(x), abs(x)
6+
x^x, x + x, x*x, x-x, x/x # warm up
7+
8+
@test (@allocations SymEngine.sin!(a,x)) == 0
9+
@test (@allocations SymEngine.cos!(a,x)) == 0
10+
@test (@allocations SymEngine.pow!(a,x,x)) == 0
11+
12+
# still allocates 1 (or 2)
13+
@test (@allocations SymEngine.add!(a,x,y)) < (@allocations x+y)
14+
@test (@allocations SymEngine.sub!(a,x,y)) < (@allocations x-y)
15+
@test (@allocations SymEngine.mul!(a,x,y)) < (@allocations x*y)
16+
@test (@allocations SymEngine.div!(a,x,y)) < (@allocations x/y)
17+
@test (@allocations SymEngine.abs2!(a,x)) < (@allocations abs2(x))
18+
end

0 commit comments

Comments
 (0)