Skip to content

Commit 6260254

Browse files
test: make solution interface tests independent of variable order
1 parent 1b59fd2 commit 6260254

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/downstream/solution_interface.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ prob = ODEProblem(sys, [u0; p], tspan)
103103
sol = solve(prob, Rodas4())
104104

105105
@test_throws ArgumentError sol[x]
106-
@test in(sol[lorenz1.x], [getindex.(sol.u, 1) for i in 1:length(unknowns(sol.prob.f.sys))])
106+
@test in(sol[lorenz1.x], [getindex.(sol.u, i) for i in 1:length(unknowns(sol.prob.f.sys))])
107107
@test_throws KeyError sol[:x]
108108

109109
### Non-symbolic indexing tests
@@ -331,13 +331,14 @@ end
331331
@test _idxs == [1]
332332
@test _ss isa SciMLBase.SavedSubsystem
333333
_idxs, _ss = SciMLBase.get_save_idxs_and_saved_subsystem(prob, x)
334-
@test _idxs == 1
334+
xidx = variable_index(prob, x)
335+
@test _idxs == xdx
335336
@test _ss isa SciMLBase.SavedSubsystem
336337
_idxs, _ss = SciMLBase.get_save_idxs_and_saved_subsystem(prob, [x])
337-
@test _idxs == [1]
338+
@test _idxs == [xidx]
338339
@test _ss isa SciMLBase.SavedSubsystem
339340
_idxs, _ss = SciMLBase.get_save_idxs_and_saved_subsystem(prob, [x, q])
340-
@test _idxs == [1]
341+
@test _idxs == [xidx]
341342
@test _ss isa SciMLBase.SavedSubsystem
342343
_idxs, _ss = SciMLBase.get_save_idxs_and_saved_subsystem(prob, [q])
343344
@test _idxs == Int[]

0 commit comments

Comments
 (0)