Skip to content

Commit ad18dbf

Browse files
test: test getu with parameter symbols and parameter timeseries
1 parent 8e7497f commit ad18dbf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/parameter_indexing_test.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ end
9090
function Base.getproperty(fs::FakeSolution, s::Symbol)
9191
s === :ps ? ParameterIndexingProxy(fs) : getfield(fs, s)
9292
end
93+
SymbolicIndexingInterface.state_values(fs::FakeSolution) = fs.u
94+
SymbolicIndexingInterface.current_time(fs::FakeSolution) = fs.t
9395
SymbolicIndexingInterface.symbolic_container(fs::FakeSolution) = fs.sys
9496
SymbolicIndexingInterface.parameter_values(fs::FakeSolution) = fs.p[end]
9597
SymbolicIndexingInterface.parameter_values(fs::FakeSolution, i) = fs.p[end][i]
@@ -149,3 +151,20 @@ for (sym, val, arrval, check_inference) in [
149151
@test get(fs, sub_inds) == arrval[sub_inds]
150152
end
151153
end
154+
155+
ps = fs.p[2:2:end]
156+
avals = getindex.(ps, 1)
157+
bvals = getindex.(ps, 2)
158+
cvals = getindex.(ps, 3)
159+
for (sym, val, arrval) in [
160+
(:a, p[1], avals),
161+
((:b, :c), p[2:3], tuple.(bvals, cvals)),
162+
([:c, :a], p[[3, 1]], vcat.(cvals, avals))
163+
]
164+
get = getu(sys, sym)
165+
@inferred get(fs)
166+
@test get(fs) == arrval
167+
for i in eachindex(ps)
168+
@test get(fs, i) == arrval[i]
169+
end
170+
end

0 commit comments

Comments
 (0)