Skip to content

Commit bc0239c

Browse files
test: update NonlinearSystem tests with new Initial parameters
1 parent ca7b9c1 commit bc0239c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

test/nonlinearsystem.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,13 @@ testdict = Dict([:test => 1])
239239

240240
prob_ = remake(prob, u0 = [1.0, 2.0, 3.0], p = [a => 1.1, b => 1.2, c => 1.3])
241241
@test prob_.u0 == [1.0, 2.0, 3.0]
242-
@test prob_.p == MTKParameters(sys, [a => 1.1, b => 1.2, c => 1.3])
242+
initials = unknowns(sys) .=> ones(3)
243+
@test prob_.p == MTKParameters(sys, [a => 1.1, b => 1.2, c => 1.3, initials...])
243244

244245
prob_ = remake(prob, u0 = Dict(y => 2.0), p = Dict(a => 2.0))
245246
@test prob_.u0 == [1.0, 2.0, 1.0]
246-
@test prob_.p == MTKParameters(sys, [a => 2.0, b => 1.0, c => 1.0])
247+
initials = [x => 1.0, y => 2.0, z => 1.0]
248+
@test prob_.p == MTKParameters(sys, [a => 2.0, b => 1.0, c => 1.0, initials...])
247249
end
248250

249251
@testset "Observed function generation without parameters" begin

test/parameter_dependencies.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ end
326326
eqs = [0 ~ p1 * x * exp(x) + p2]
327327
@mtkbuild sys = NonlinearSystem(eqs; parameter_dependencies = [p2 => 2p1])
328328
@test isequal(only(parameters(sys)), p1)
329-
@test Set(full_parameters(sys)) == Set([p1, p2, Initial(p2)])
329+
@test Set(full_parameters(sys)) == Set([p1, p2, Initial(p2), Initial(x)])
330330
prob = NonlinearProblem(sys, [x => 1.0])
331331
@test prob.ps[p1] == 1.0
332332
@test prob.ps[p2] == 2.0

0 commit comments

Comments
 (0)