Skip to content

Commit 11dc663

Browse files
fix MTK tests due to one(x) change in StaticArrays
1 parent 5a6f90b commit 11dc663

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src/function_registration.jl

+1
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ Base.:^(x::Expression,y::T) where T <: Rational = Operation(Base.:^, Expression[
5959
@register Base.conj(x)
6060
@register Base.getindex(x,i)
6161
Base.getindex(x::Operation,i::Int64) = Operation(getindex,[x,i])
62+
Base.one(::Operation) = 1

src/simplify.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end
1414
simplify_constants(x, shorten_tree) = x
1515
simplify_constants(x) = simplify_constants(x, true)
1616

17-
17+
Base.isone(x::Operation) = x.op == one || x.op == Constant && isone(x.args)
1818
const AC_OPERATORS = (*, +)
1919

2020
function _simplify_constants(O::Operation, shorten_tree)

test/direct.jl

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ for i in 1:3
2626
= ModelingToolkit.gradient(eqs[i],[x,y,z])
2727
@test isequal(∂[i,:],∇)
2828
end
29+
2930
@test all(isequal.(ModelingToolkit.gradient(eqs[1],[x,y,z]),[σ * -1,σ,0]))
3031
@test all(isequal.(ModelingToolkit.hessian(eqs[1],[x,y,z]),0))
3132

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ using ModelingToolkit, Test
99
@testset "Constraints Test" begin include("constraints.jl") end
1010
@testset "PDE Construction Test" begin include("pde.jl") end
1111
@testset "Distributed Test" begin include("distributed.jl") end
12-
#@testset "Latexify recipes Test" begin include("latexify.jl") end
12+
@testset "Latexify recipes Test" begin include("latexify.jl") end

0 commit comments

Comments
 (0)