Skip to content

Commit 1ff6598

Browse files
committed
Add test
1 parent 2611624 commit 1ff6598

File tree

5 files changed

+6
-0
lines changed

5 files changed

+6
-0
lines changed

test/discretesystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ u0 = [S => 990.0, I => 10.0, R => 0.0]
3232
p ==> 0.05, c => 10.0, γ => 0.25, δt => 0.1, nsteps => 400]
3333
tspan = (0.0, ModelingToolkit.value(substitute(nsteps, p))) # value function (from Symbolics) is used to convert a Num to Float64
3434
prob_map = DiscreteProblem(sys, u0, tspan, p)
35+
@test prob_map.f.sys === sys
3536

3637
# Solution
3738
using OrdinaryDiffEq

test/nonlinearsystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ sH = calculate_hessian(ns)
7979
getfield.(sparse.(sH), :rowval)
8080

8181
prob = NonlinearProblem(ns, ones(3), ones(3))
82+
@test prob.f.sys === ns
8283
sol = solve(prob, NewtonRaphson())
8384
@test sol.u[1] sol.u[2]
8485

test/odesystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ p2 = (k₁ => 0.04,
213213
k₃ => 1e4)
214214
tspan = (0.0, 100000.0)
215215
prob1 = ODEProblem(sys, u0, tspan, p)
216+
@test prob1.f.sys === sys
216217
prob12 = ODEProblem(sys, u0, tspan, [0.04, 3e7, 1e4])
217218
prob13 = ODEProblem(sys, u0, tspan, (0.04, 3e7, 1e4))
218219
prob14 = ODEProblem(sys, u0, tspan, p2)

test/optimizationsystem.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ p = [sys1.a => 6.0
4141
β => 10.0]
4242

4343
prob = OptimizationProblem(combinedsys, u0, p, grad = true)
44+
@test prob.f.sys === combinedsys
4445
sol = solve(prob, NelderMead())
4546
@test sol.minimum < -1e5
4647

@@ -54,6 +55,7 @@ sol = solve(prob2, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
5455
prob = OptimizationProblem(sys2, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0],
5556
lcons = [-1.0, -1.0], ucons = [500.0, 500.0], grad = true,
5657
hess = true)
58+
@test prob.f.sys === sys2
5759
sol = solve(prob, IPNewton(), allow_f_increases = true)
5860
@test sol.minimum < 1.0
5961
sol = solve(prob, Ipopt.Optimizer())

test/sdesystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ parammap = [
7171
]
7272

7373
prob = SDEProblem(de, u0map, (0.0, 100.0), parammap)
74+
@test prob.f.sys === de
7475
@test size(prob.noise_rate_prototype) == (3, 3)
7576
@test prob.noise_rate_prototype isa Matrix
7677
sol = solve(prob, EM(), dt = 0.001)

0 commit comments

Comments
 (0)