From 51036adf472e6b32d0057d7a6cecb17e53d0fcbc Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Thu, 6 Apr 2023 12:23:33 +0200 Subject: [PATCH 1/3] add bools to promote rule --- src/types.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types.jl b/src/types.jl index d778a69..03beb7d 100644 --- a/src/types.jl +++ b/src/types.jl @@ -96,6 +96,7 @@ Basic(x::Basic) = x Base.promote_rule(::Type{Basic}, ::Type{S}) where {S<:Number} = Basic Base.promote_rule(::Type{S}, ::Type{Basic}) where {S<:Number} = Basic Base.promote_rule(::Type{S}, ::Type{Basic}) where {S<:AbstractIrrational} = Basic +Base.promote_rule(::Type{Bool}, ::Type{Basic}) = Basic ## Class ID get_type(s::Basic) = ccall((:basic_get_type, libsymengine), UInt, (Ref{Basic},), s) From d2a769cfb71eb28406c909f421c370828997d283 Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Thu, 6 Apr 2023 12:26:03 +0200 Subject: [PATCH 2/3] add test --- test/runtests.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 46db2cc..92a2f54 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -42,6 +42,10 @@ c = prod(convert(SymEngine.CVecBasic, [x, x, 2])) @test 2 * x * 3 == 6 * x @test 3 * 2 * x == 6 * x +# Issue #146 +@test x + true == x + 1 +@test x + false == x + false + c = x ^ 5 @test diff(c, x) == 5 * x ^ 4 From 097102f2b504e0578648aa6a77123135be42772d Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Sun, 9 Apr 2023 10:35:57 +0200 Subject: [PATCH 3/3] update tests --- test/runtests.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 92a2f54..73ae2d4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -43,8 +43,10 @@ c = prod(convert(SymEngine.CVecBasic, [x, x, 2])) @test 3 * 2 * x == 6 * x # Issue #146 -@test x + true == x + 1 -@test x + false == x + false +@test x + true == x + 1 +@test x + false == x +@test x * true == x +@test x * false == 0 c = x ^ 5 @test diff(c, x) == 5 * x ^ 4