Skip to content

Commit 5dc4654

Browse files
committed
update tests
1 parent ea51a88 commit 5dc4654

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

test/upstream/mtk_problem_inputs.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ let
218218
]
219219

220220
# Loops through all potential parameter sets, checking their inputs yield errors.
221-
for ps in [ps_valid; ps_invalid], u0 in [u0_valid; u0s_invalid]
221+
for ps in [[ps_valid]; ps_invalid], u0 in [[u0_valid]; u0s_invalid]
222222
# Handles problems with/without tspan separately. Special check ensuring that valid inputs passes.
223223
for XProblem in [ODEProblem, SDEProblem, DiscreteProblem]
224-
if (ps == ps_valid) && (u0 == u0_valid)
224+
if isequal(ps, ps_valid) && isequal(u0, u0_valid)
225225
XProblem(rn, u0, (0.0, 1.0), ps); @test true;
226226
else
227227
# Several of these cases do not throw errors (https://github.com/SciML/ModelingToolkit.jl/issues/2624).
@@ -231,7 +231,7 @@ let
231231
end
232232
end
233233
for XProblem in [NonlinearProblem, SteadyStateProblem]
234-
if (ps == ps_valid) && (u0 == u0_valid)
234+
if isequal(ps, ps_valid) && isequal(u0, u0_valid)
235235
XProblem(rn, u0, ps); @test true;
236236
else
237237
@test_broken false
@@ -240,4 +240,4 @@ let
240240
end
241241
end
242242
end
243-
end
243+
end

test/upstream/mtk_structure_indexing.jl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ begin
4646
eproblems = [eoprob, esprob, edprob, ejprob, enprob, essprob]
4747

4848
# Creates integrators.
49-
oint = init(oprob, Tsit5(); save_everystep=false)
50-
sint = init(sprob, ImplicitEM(); save_everystep=false)
49+
oint = init(oprob, Tsit5(); save_everystep = false)
50+
sint = init(sprob, ImplicitEM(); save_everystep = false)
5151
jint = init(jprob, SSAStepper())
52-
nint = init(nprob, NewtonRaphson(); save_everystep=false)
53-
@test_broken ssint = init(ssprob, DynamicSS(Tsit5()); save_everystep=false) # https://github.com/SciML/SciMLBase.jl/issues/660
52+
nint = init(nprob, NewtonRaphson(); save_everystep = false)
53+
@test_broken ssint = init(ssprob, DynamicSS(Tsit5()); save_everystep = false) # https://github.com/SciML/SciMLBase.jl/issues/660
5454
integrators = [oint, sint, jint, nint]
5555

5656
# Creates solutions.
@@ -64,14 +64,17 @@ end
6464

6565
# Tests problem indexing and updating.
6666
let
67+
6768
@test_broken false # A few cases fails for SteadyStateProblem: https://github.com/SciML/SciMLBase.jl/issues/660
6869
@test_broken false # Most cases broken for Ensemble problems: https://github.com/SciML/SciMLBase.jl/issues/661
69-
for prob in deepcopy(problems[1:end-1])
70+
@test_broken false # Cannot run deepcopy of SteadyStateProblem and Nonlinear Problems.
71+
@test_broken false # A few cases fails for JumpProblems.
72+
for prob in deepcopy([oprob, sprob, dprob])
7073
# Get u values (including observables).
7174
@test prob[X] == prob[model.X] == prob[:X] == 4
7275
@test prob[XY] == prob[model.XY] == prob[:XY] == 9
7376
@test prob[[XY,Y]] == prob[[model.XY,model.Y]] == prob[[:XY,:Y]] == [9, 5]
74-
@test_broken prob[(XY,Y)] == prob[(model.XY,model.Y)] == prob[(:XY,:Y)] == (9, 5)
77+
@test prob[(XY,Y)] == prob[(model.XY,model.Y)] == prob[(:XY,:Y)] == (9, 5)
7578
@test getu(prob, X)(prob) == getu(prob, model.X)(prob) == getu(prob, :X)(prob) == 4
7679
@test getu(prob, XY)(prob) == getu(prob, model.XY)(prob) == getu(prob, :XY)(prob) == 9
7780
@test getu(prob, [XY,Y])(prob) == getu(prob, [model.XY,model.Y])(prob) == getu(prob, [:XY,:Y])(prob) == [9, 5]
@@ -117,8 +120,10 @@ end
117120

118121
# Test remake function.
119122
let
123+
@test_broken false # A few cases fails for JumpProblems.
124+
@test_broken false # Cannot run deepcopy of SteadyStateProblem and Nonlinear Problems.
120125
@test_broken false # Currently cannot be run for Ensemble problems: https://github.com/SciML/SciMLBase.jl/issues/661 (as indexing cannot be used to check values).
121-
for prob in deepcopy(problems)
126+
for prob in deepcopy([oprob, sprob, dprob])
122127
# Remake for all u0s.
123128
rp = remake(prob; u0 = [X => 1, Y => 2])
124129
@test rp[[X, Y]] == [1, 2]
@@ -155,10 +160,8 @@ end
155160

156161
# Test integrator indexing.
157162
let
158-
@test_broken false # NOTE: Multiple problems for `nint` (https://github.com/SciML/SciMLBase.jl/issues/662).
159-
@test_broken false # NOTE: Multiple problems for `jint` (https://github.com/SciML/SciMLBase.jl/issues/654).
160163
@test_broken false # NOTE: Cannot even create a `ssint` (https://github.com/SciML/SciMLBase.jl/issues/660).
161-
for int in deepcopy([oint, sint])
164+
for int in deepcopy([oint, sint, jint, nint])
162165
# Get u values.
163166
@test int[X] == int[model.X] == int[:X] == 4
164167
@test int[XY] == int[model.XY] == int[:XY] == 9
@@ -262,7 +265,7 @@ let
262265
@test sol[X] == sol[model.X] == sol[:X]
263266
@test sol[XY] == sol[model.XY][1] == sol[:XY]
264267
@test sol[[XY,Y]] == sol[[model.XY,model.Y]] == sol[[:XY,:Y]]
265-
@test_broken sol[(XY,Y)] == sol[(model.XY,model.Y)] == sol[(:XY,:Y)]
268+
@test sol[(XY,Y)] == sol[(model.XY,model.Y)] == sol[(:XY,:Y)]
266269
@test getu(sol, X)(sol) == getu(sol, model.X)(sol)[1] == getu(sol, :X)(sol)
267270
@test getu(sol, XY)(sol) == getu(sol, model.XY)(sol)[1] == getu(sol, :XY)(sol)
268271
@test getu(sol, [XY,Y])(sol) == getu(sol, [model.XY,model.Y])(sol) == getu(sol, [:XY,:Y])(sol)
@@ -282,7 +285,7 @@ end
282285
# Tests plotting.
283286
let
284287
@test_broken false # Currently broken for `ssol` (https://github.com/SciML/SciMLBase.jl/issues/580)
285-
for sol in deepcopy([osol, jsol])
288+
for sol in deepcopy([osol, ssol, jsol])
286289
# Single variable.
287290
@test length(plot(sol; idxs = X).series_list) == 1
288291
@test length(plot(sol; idxs = XY).series_list) == 1

0 commit comments

Comments
 (0)