Skip to content

Commit a71c48f

Browse files
test: fix tests
1 parent 231f4cd commit a71c48f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

test/components.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ let
9898
[resistor, resistor2, capacitor, source, ground])
9999
sys2 = structural_simplify(rc_model2)
100100
prob2 = ODEProblem(sys2, u0, (0, 10.0))
101-
sol2 = solve(prob2, Tsit5())
101+
sol2 = solve(prob2, Rosenbrock23())
102102
@test sol2[source.p.i] sol2[rc_model2.source.p.i] -sol2[capacitor.i]
103103
end
104104

test/state_selection.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ let
196196
prob1 = ODEProblem(sys, u0, (0.0, 0.1))
197197
prob2 = ODEProblem(sys, u0, (0.0, 0.1))
198198
@test solve(prob1, FBDF()).retcode == ReturnCode.Success
199-
@test_broken solve(prob2, FBDF()).retcode == ReturnCode.Success
199+
@test solve(prob2, FBDF()).retcode == ReturnCode.Success
200200
end
201201

202202
let

test/structural_transformation/tearing.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,35 +155,35 @@ newdaesys = structural_simplify(daesys)
155155
@test equations(newdaesys) == [D(x) ~ z; 0 ~ y + sin(z) - p * t]
156156
@test equations(tearing_substitution(newdaesys)) == [D(x) ~ z; 0 ~ x + sin(z) - p * t]
157157
@test isequal(states(newdaesys), [x, z])
158-
@test_deprecated ODAEProblem(newdaesys, [x => 1.0], (0, 1.0), [p => 0.2])
159-
prob = ODEProblem(newdaesys, [x => 1.0], (0, 1.0), [p => 0.2])
160-
du = [0.0];
161-
u = [1.0];
158+
@test_deprecated ODAEProblem(newdaesys, [x => 1.0, z => -0.5π], (0, 1.0), [p => 0.2])
159+
prob = ODEProblem(newdaesys, [x => 1.0, z => -0.5π], (0, 1.0), [p => 0.2])
160+
du = [0.0, 0.0];
161+
u = [1.0, -0.5π];
162162
pr = 0.2;
163163
tt = 0.1;
164164
@test_skip (@ballocated $(prob.f)($du, $u, $pr, $tt)) == 0
165165
prob.f(du, u, pr, tt)
166-
@test du[-asin(u[1] - pr * tt)] atol=1e-5
166+
@test du [u[2], u[1] + sin(u[2]) - pr * tt] atol=1e-5
167167

168168
# test the initial guess is respected
169169
@named sys = ODESystem(eqs, t, defaults = Dict(z => Inf))
170170
infprob = ODEProblem(structural_simplify(sys), [x => 1.0], (0, 1.0), [p => 0.2])
171-
@test_throws Any infprob.f(du, u, pr, tt)
171+
@test_throws Any infprob.f(du, infprob.u0, pr, tt)
172172

173-
sol1 = solve(prob, Tsit5())
173+
sol1 = solve(prob, RosShamp4(), reltol=8e-7)
174174
sol2 = solve(ODEProblem{false}((u, p, t) -> [-asin(u[1] - pr * t)],
175175
[1.0],
176176
(0, 1.0),
177177
0.2), Tsit5(), tstops = sol1.t, adaptive = false)
178-
@test Array(sol1)Array(sol2) atol=1e-5
178+
@test Array(sol1[x])Array(sol2[1, :]) atol=1e-5
179179

180180
@test sol1[x] == first.(sol1.u)
181181
@test sol1[y] == first.(sol1.u)
182-
@test sin.(sol1[z]) .+ sol1[y]pr[1] * sol1.t atol=1e-5
182+
@test sin.(sol1[z]) .+ sol1[y]pr[1] * sol1.t atol=5e-5
183183
@test sol1[sin(z) + y]sin.(sol1[z]) .+ sol1[y] rtol=1e-12
184184

185185
@test sol1[y, :] == sol1[x, :]
186-
@test (@. sin(sol1[z, :]) + sol1[y, :])pr * sol1.t atol=1e-5
186+
@test (@. sin(sol1[z, :]) + sol1[y, :])pr * sol1.t atol=5e-5
187187

188188
# 1426
189189
function Translational_Mass(; name, m = 1.0)

0 commit comments

Comments
 (0)