Skip to content

Commit 7a8dc9d

Browse files
committed
Make tests more robust
1 parent 4a8dc53 commit 7a8dc9d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/direct.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ simpexpr = [
4040
:($(+)($(*)(x, y), $(*)(-1, z, β)))
4141
]
4242

43+
σ, β, ρ = 2//3, 3//4, 4//5
44+
x, y, z = 6//7, 7//8, 8//9
4345
for i in 1:3
44-
@test ModelingToolkit.toexpr.(eqs)[i] == simpexpr[i]
45-
@test ModelingToolkit.toexpr.(eqs)[i] == simpexpr[i]
46+
@test eval(ModelingToolkit.toexpr.(eqs)[i]) == eval(simpexpr[i])
47+
@test eval(ModelingToolkit.toexpr.(eqs)[i]) == eval(simpexpr[i])
4648
end
4749

50+
@parameters t σ ρ β
51+
@variables x y z
4852
= ModelingToolkit.jacobian(eqs,[x,y,z])
4953
for i in 1:3
5054
= ModelingToolkit.gradient(eqs[i],[x,y,z])

test/reduction.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ nlprob = NonlinearProblem(reducedsys, u0, pp)
212212
reducedsol = solve(nlprob, NewtonRaphson())
213213
residual = fill(100.0, length(states(reducedsys)))
214214
nlprob.f(residual, reducedsol.u, pp)
215-
@test hypot(nlprob.f.observed(u2, reducedsol.u, pp), nlprob.f.observed(u1, reducedsol.u, pp)) * pp reducedsol.u atol=1e-9
215+
@test hypot(nlprob.f.observed(u2, reducedsol.u, pp), nlprob.f.observed(u1, reducedsol.u, pp)) * pp[1] nlprob.f.observed(u3, reducedsol.u, pp) atol=1e-9
216216

217217
@test all(x->abs(x) < 1e-5, residual)
218218

0 commit comments

Comments
 (0)