Skip to content

Commit 3f205d4

Browse files
Fix test
1 parent ee83816 commit 3f205d4

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/equations.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ mutable struct Equation
66
rhs::Expression
77
end
88
Base.broadcastable(eq::Equation) = Ref(eq)
9+
Base.:(==)(a::Equation, b::Equation) = (a.lhs, a.rhs) == (b.lhs, b.rhs)
910

1011
Base.:~(lhs::Expression, rhs::Expression) = Equation(lhs, rhs)
1112
Base.:~(lhs::Expression, rhs::Number ) = Equation(lhs, rhs)

src/systems/diffeqs/diffeqsystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function Base.convert(::Type{DiffEq}, eq::Equation)
1212
isintermediate(eq) && throw(ArgumentError("intermediate equation received"))
1313
return DiffEq(eq.lhs.op, eq.lhs.args[1], eq.rhs)
1414
end
15+
Base.:(==)(a::DiffEq, b::DiffEq) = (a.D, a.var, a.rhs) == (b.D, b.var, b.rhs)
1516
get_args(eq::DiffEq) = Expression[eq.var, eq.rhs]
1617

1718
struct DiffEqSystem <: AbstractSystem

src/systems/diffeqs/first_order_transform.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,26 @@ function ode_order_lowering!(eqs, naming_scheme)
3030
var_order[var] = maxorder
3131
var vars || push!(vars, var)
3232
end
33-
lhs_renaming!(eq, naming_scheme)
33+
lhs_renaming!(eq, D, naming_scheme)
3434
rhs_renaming!(eq, naming_scheme)
3535
end
3636

3737
for var vars
3838
order = var_order[var]
3939
for o in (order-1):-1:1
40-
lhs = D(lower_varname(var, idv, o-1, naming_scheme))
40+
lvar = lower_varname(var, idv, o-1, naming_scheme)
4141
rhs = lower_varname(var, idv, o, naming_scheme)
42-
eq = Equation(lhs, rhs)
42+
eq = DiffEq(D, lvar, rhs)
4343
push!(eqs, eq)
4444
end
4545
end
4646

4747
return eqs
4848
end
4949

50-
function lhs_renaming!(eq::DiffEq, naming_scheme)
50+
function lhs_renaming!(eq::DiffEq, D, naming_scheme)
5151
eq.var = lower_varname(eq.D, eq.var, naming_scheme, lower=true)
52+
eq.D = D
5253
return eq
5354
end
5455
rhs_renaming!(eq::DiffEq, naming_scheme) = _rec_renaming!(eq.rhs, naming_scheme)

test/system_construction.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ lowered_eqs = [D(u_tt) ~ 2u_tt + u_t + x_t + 1
4545
D(u_t) ~ u_tt
4646
D(u) ~ u_t
4747
D(x) ~ x_t]
48-
@test_broken de1.eqs == lowered_eqs
48+
@test de1.eqs == convert.(ModelingToolkit.DiffEq, lowered_eqs)
4949

5050
# Internal calculations
5151
a = y - x

0 commit comments

Comments
 (0)