Skip to content

Commit 77c1290

Browse files
test: fix tests
1 parent 509aea8 commit 77c1290

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
@@ -156,35 +156,35 @@ newdaesys = structural_simplify(daesys)
156156
@test equations(tearing_substitution(newdaesys)) == [D(x) ~ z; 0 ~ x + sin(z) - p * t]
157157
@test isequal(unknowns(newdaesys), [x, z])
158158
@test isequal(states(newdaesys), [x, z])
159-
@test_deprecated ODAEProblem(newdaesys, [x => 1.0], (0, 1.0), [p => 0.2])
160-
prob = ODEProblem(newdaesys, [x => 1.0], (0, 1.0), [p => 0.2])
161-
du = [0.0];
162-
u = [1.0];
159+
@test_deprecated ODAEProblem(newdaesys, [x => 1.0, z => -0.5π], (0, 1.0), [p => 0.2])
160+
prob = ODEProblem(newdaesys, [x => 1.0, z => -0.5π], (0, 1.0), [p => 0.2])
161+
du = [0.0, 0.0];
162+
u = [1.0, -0.5π];
163163
pr = 0.2;
164164
tt = 0.1;
165165
@test_skip (@ballocated $(prob.f)($du, $u, $pr, $tt)) == 0
166166
prob.f(du, u, pr, tt)
167-
@test du[-asin(u[1] - pr * tt)] atol=1e-5
167+
@test du [u[2], u[1] + sin(u[2]) - pr * tt] atol=1e-5
168168

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

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

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

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

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

0 commit comments

Comments
 (0)