Skip to content

Commit ec8ccab

Browse files
committed
some tests
1 parent a5dfa93 commit ec8ccab

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

test/runtests.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,20 @@ t = BigFloat(1.23)
342342
@test Basic(:(-y)) == -y
343343
@test Basic(:(-2*(x-2*y))) == -2*(x-2*y)
344344

345+
# Check that constructing Basic from Irrational works
346+
for a (:pi, :ℯ, :e, , ,
347+
MathConstants.eulergamma,
348+
MathConstants.π,
349+
MathConstants.catalan,
350+
MathConstants.pi,
351+
MathConstants.φ,
352+
MathConstants.ℯ,
353+
MathConstants.e,
354+
MathConstants.golden,
355+
MathConstants.γ)
356+
@test Basic(a) isa Basic
357+
end
358+
345359
@test Basic(0)/0 == NAN
346360
@test subs(1/x, x, 0) == Basic(1)/0
347361

@@ -352,6 +366,8 @@ d = Dict(x=>y, y=>x)
352366
@test sin(PI/2-x) == cos(x)
353367

354368
f = SymFunction("f")
369+
@test nameof(f) == :f
370+
@test_throws MethodError nameof(f(x))
355371
@test string(f(x, y)) == "f(x, y)"
356372
@test string(f([x, y])) == "f(x, y)"
357373
@test string(f(2*x)) == "f(2*x)"

test/test-SymbolicUtils.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ using SymEngine
33

44
import TermInterface
55
@testset "TermInterface" begin
6-
@vars x
6+
@vars x, ()
77
@test !TermInterface.iscall(x)
88
@test TermInterface.iscall(x^2)
99
@test TermInterface.operation(sin(x)) == sin
1010
@test TermInterface.arguments(sin(x)) == [x]
11+
@test nameof(TermInterface.operation((sin(x), x))) == nameof(∫)
1112
end
1213

1314
#=

0 commit comments

Comments
 (0)