Skip to content

Commit 846b12b

Browse files
committed
fix: fix jumpsystem test
1 parent a63853a commit 846b12b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/systems/callbacks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function make_affect(affect::Vector{Equation}; discrete_parameters = Any[],
283283
for eq in affect
284284
if !haspre(eq) && !(symbolic_type(eq.rhs) === NotSymbolic() ||
285285
symbolic_type(eq.lhs) === NotSymbolic())
286-
@warn "Affect equation $eq has no `Pre` operator. As such it will be interpreted as an algebraic equation to be satisfied after the callback. If you intended to use the value of a variable x before the affect, use Pre(x)."
286+
@warn "Affect equation $eq has no `Pre` operator. As such it will be interpreted as an algebraic equation to be satisfied after the callback. If you intended to use the value of a variable x before the affect, use Pre(x). Errors may be thrown if there is no `Pre` and algebraic equations are unsatisfiable, such as X ~ X + 1."
287287
end
288288
collect_vars!(dvs, params, eq, iv; op = Pre)
289289
diffvs = collect_applied_operators(eq, Differential)

test/jumpsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ end
558558
@parameters a b
559559
eq = D(X) ~ a
560560
rate = b * X
561-
affect = [X ~ X - 1]
561+
affect = [X ~ Pre(X) - 1]
562562
crj = ConstantRateJump(rate, affect)
563563
@named jsys = JumpSystem([crj, eq], t, [X], [a, b])
564564
jsys = complete(jsys)

test/symbolic_events.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ end
638638
sol = solve(prob, Tsit5(), saveat = 0.1)
639639

640640
@test typeof(oneosc_ce_simpl) == ODESystem
641-
@test sol[1, 6] < 1.0 # test whether x(t) decreases over time
642-
@test sol[1, 18] > 0.5 # test whether event happened
641+
@test sol(0.5, idxs = oscce.x) < 1.0 # test whether x(t) decreases over time
642+
@test sol(1.5, idxs = oscce.x) > 0.5 # test whether event happened
643643
end
644644

645645
@testset "Additional SymbolicContinuousCallback options" begin

0 commit comments

Comments
 (0)