Skip to content

Commit a87259e

Browse files
adds test
1 parent 0baecb2 commit a87259e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/odesystem.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,30 @@ sol_dpmap = solve(prob_dpmap, Rodas5())
250250

251251
@test sol_pmap.u sol_dpmap.u
252252

253+
@testset "symbolic remake with nested system" begin
254+
function makesys(name)
255+
@parameters t a=1.0
256+
@variables x(t) = 0.0
257+
D = Differential(t)
258+
ODESystem([D(x) ~ -a * x]; name)
259+
end
260+
261+
function makecombinedsys()
262+
sys1 = makesys(:sys1)
263+
sys2 = makesys(:sys2)
264+
@parameters t b=1.0
265+
ODESystem(Equation[], t, [], [b]; systems = [sys1, sys2], name = :foo)
266+
end
267+
268+
sys = makecombinedsys()
269+
@unpack sys1, b = sys
270+
prob = ODEProblem(sys, Pair[])
271+
prob_new = SciMLBase.remake(prob, p = Dict(sys1.a => 3.0, b => 4.0),
272+
u0 = Dict(sys1.x => 1.0))
273+
@test prob_new.p == [4.0, 3.0, 1.0]
274+
@test prob_new.u0 == [1.0, 0.0]
275+
end
276+
253277
# test kwargs
254278
prob2 = ODEProblem(sys, u0, tspan, p, jac = true)
255279
prob3 = ODEProblem(sys, u0, tspan, p, jac = true, sparse = true) #SparseMatrixCSC need to handle

0 commit comments

Comments
 (0)