Skip to content

Commit fb14d69

Browse files
test: update serialization tests
1 parent 6b1d3f2 commit fb14d69

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

test/serialization.jl

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ sys = complete(sys)
88
for prob in [
99
eval(ModelingToolkit.ODEProblem{false}(sys, nothing, nothing,
1010
SciMLBase.NullParameters())),
11-
eval(ModelingToolkit.ODEProblemExpr{false}(sys, nothing, nothing,
12-
SciMLBase.NullParameters()))
11+
eval(ModelingToolkit.ODEProblem{false}(sys, nothing, nothing,
12+
SciMLBase.NullParameters(); expression = Val{true}))
1313
]
1414
_fn = tempname()
1515

@@ -47,26 +47,8 @@ sol_ = solve(prob_, ImplicitEuler())
4747
## Check ODEProblemExpr with Observables -----------
4848

4949
# build the observable function expression
50-
obs_exps = []
51-
for var in all_obs
52-
f = ModelingToolkit.build_explicit_observed_function(ss, var; expression = true)
53-
sym = ModelingToolkit.getname(var) |> string
54-
ex = :(if name == Symbol($sym)
55-
return $f(u0, p, t)
56-
end)
57-
push!(obs_exps, ex)
58-
end
59-
# observedfun expression for ODEFunctionExpr
60-
observedfun_exp = :(function obs(var, u0, p, t)
61-
if var isa AbstractArray
62-
return obs.(var, (u0,), (p,), (t,))
63-
end
64-
name = ModelingToolkit.getname(var)
65-
$(obs_exps...)
66-
end)
67-
6850
# ODEProblemExpr with observedfun_exp included
69-
probexpr = ODEProblemExpr{true}(ss, [capacitor.v => 0.0], (0, 0.1); observedfun_exp);
51+
probexpr = ODEProblem{true}(ss, [capacitor.v => 0.0], (0, 0.1); expr = Val{true});
7052
prob_obs = eval(probexpr)
7153
sol_obs = solve(prob_obs, ImplicitEuler())
7254
@show all_obs

0 commit comments

Comments
 (0)