Skip to content

Commit 647d9d4

Browse files
committed
Add tests
1 parent e6e0cc7 commit 647d9d4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/debugging.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ end
2323

2424
function logged_fun(f, args...)
2525
# Currently we don't really support complex numbers
26-
term(LoggedFun(f, args), args..., type=Real)
26+
term(LoggedFun(f, args), args..., type = Real)
2727
end
2828

2929
debug_sub(eq::Equation) = debug_sub(eq.lhs) ~ debug_sub(eq.rhs)
3030
function debug_sub(ex)
3131
istree(ex) || return ex
3232
f = operation(ex)
3333
args = map(debug_sub, arguments(ex))
34-
f in LOGGED_FUN ? logged_fun(f, args...) : similarterm(ex, f, args, metadata=metadata(ex))
34+
f in LOGGED_FUN ? logged_fun(f, args...) :
35+
similarterm(ex, f, args, metadata = metadata(ex))
3536
end

test/odesystem.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,3 +889,15 @@ eqs = [D(q) ~ -p / L - F
889889
testdict = Dict([:name => "test"])
890890
@named sys = ODESystem(eqs, t, metadata = testdict)
891891
@test get_metadata(sys) == testdict
892+
893+
@variables t P(t)=0 Q(t)=2
894+
∂t = Differential(t)
895+
896+
eqs = [∂t(Q) ~ 1 / sin(P)
897+
∂t(P) ~ log(-cos(Q))]
898+
@named sys = ODESystem(eqs, t, [P, Q], [])
899+
sys = debug_system(sys);
900+
prob = ODEProblem(sys, [], (0, 1.0));
901+
du = zero(prob.u0);
902+
@test_throws "-cos(Q(t))" prob.f(du, [1, 0], prob.p, 0.0)
903+
@test_throws "sin(P(t))" prob.f(du, [0, 2], prob.p, 0.0)

0 commit comments

Comments
 (0)