Skip to content

Commit 3516e71

Browse files
committed
Add test
1 parent 9581dce commit 3516e71

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

test/odesystem.jl

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ let
683683
@test length(equations(structural_simplify(sys))) == 2
684684
end
685685

686-
let
686+
let
687687
eq_to_lhs(eq) = eq.lhs - eq.rhs ~ 0
688688
eqs_to_lhs(eqs) = eq_to_lhs.(eqs)
689689

@@ -708,7 +708,7 @@ let
708708
D2(u[2]) ~ u[1] * (rho - u[3]) - u[2],
709709
D2(u[3]) ~ u[1] * u[2] - beta * u[3]]
710710
eqs3 = eqs_to_lhs(eqs3)
711-
711+
712712
eqs4 = [
713713
D2(y2) ~ x2 * (rho - z2) - y2,
714714
D2(x2) ~ sigma * (y2 - x2),
@@ -724,9 +724,24 @@ let
724724
@test ModelingToolkit.isisomorphic(sys1, sys2)
725725
@test !ModelingToolkit.isisomorphic(sys1, sys3)
726726
@test ModelingToolkit.isisomorphic(sys1, ssys3) # I don't call structural_simplify in isisomorphic
727-
@test !ModelingToolkit.isisomorphic(sys1, sys4)
727+
@test !ModelingToolkit.isisomorphic(sys1, sys4)
728728

729729
# 1281
730730
iv2 = only(independent_variables(sys2))
731731
@test isequal(only(independent_variables(convert_system(ODESystem, sys1, iv2))), iv2)
732-
end
732+
end
733+
734+
let
735+
@variables t
736+
vars = @variables sP(t) spP(t) spm(t) sph(t)
737+
pars = @parameters a b
738+
eqs = [
739+
sP ~ 1
740+
spP ~ sP
741+
spm ~ a
742+
sph ~ b
743+
spm ~ 0
744+
]
745+
@named sys = ODESystem(eqs, t, vars, pars)
746+
@test_throws ModelingToolkit.ExtraEquationsSystemException structural_simplify(sys)
747+
end

0 commit comments

Comments
 (0)