Skip to content

Commit 48db08f

Browse files
test: fix symbolic events test
1 parent e8c5254 commit 48db08f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/symbolic_events.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ using ModelingToolkit, OrdinaryDiffEq, StochasticDiffEq, JumpProcesses, Test
22
using SciMLStructures: canonicalize, Discrete
33
using ModelingToolkit: SymbolicContinuousCallback,
44
SymbolicContinuousCallbacks, NULL_AFFECT,
5-
get_callback,
65
t_nounits as t,
76
D_nounits as D
87
using StableRNGs
@@ -11,6 +10,10 @@ using SymbolicIndexingInterface
1110
using Setfield
1211
rng = StableRNG(12345)
1312

13+
function get_callback(prob)
14+
prob.kwargs[:callback]
15+
end
16+
1417
@variables x(t) = 0
1518

1619
eqs = [D(x) ~ 1]
@@ -747,8 +750,7 @@ let rng = rng
747750
function testsol(jsys, u0, p, tspan; tstops = Float64[], paramtotest = nothing,
748751
N = 40000, kwargs...)
749752
jsys = complete(jsys)
750-
dprob = DiscreteProblem(jsys, u0, tspan, p)
751-
jprob = JumpProblem(jsys, dprob, Direct(); kwargs...)
753+
jprob = JumpProblem(jsys, u0, tspan, p; aggregator = Direct(), kwargs...)
752754
sol = solve(jprob, SSAStepper(); tstops = tstops)
753755
@test (sol(1.000000000001)[1] - sol(0.99999999999)[1]) == 1
754756
paramtotest === nothing || (@test sol.ps[paramtotest] == 1.0)
@@ -1415,7 +1417,7 @@ end
14151417
@named wd1 = weird1(0.021)
14161418
@named wd2 = weird2(0.021)
14171419

1418-
sys1 = structural_simplify(System([], t; name = :parent,
1420+
sys1 = structural_simplify(System(Equation[], t; name = :parent,
14191421
discrete_events = [0.01 => ModelingToolkit.ImperativeAffect(
14201422
modified = (; θs = reduce(vcat, [[wd1.θ]])), ctx = [1]) do m, o, c, i
14211423
@set! m.θs[1] = c[] += 1

0 commit comments

Comments
 (0)