Skip to content

Commit d9b3378

Browse files
test: do not rely on singular roots for tests
1 parent 9c9bc79 commit d9b3378

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/NonlinearSolveHomotopyContinuation/test/allroots.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@ alg = HomotopyContinuationJL{true}(; threading = false)
66

77
@testset "scalar u" begin
88
rhs = function (u, p)
9-
return u * u - 2p * u + p * p
9+
return u * u - p[1] * u + p[2]
1010
end
1111
jac = function (u, p)
12-
return 2u - 2p
12+
return 2u - p[1]
1313
end
1414
@testset "`NonlinearProblem` - $name" for (jac, name) in [(nothing, "no jac"), (jac, "jac")]
1515
fn = NonlinearFunction(rhs; jac)
16-
prob = NonlinearProblem(fn, 1.0, 2.0)
16+
prob = NonlinearProblem(fn, 1.0, [5.0, 6.0])
1717
sol = solve(prob, alg)
1818

1919
@test sol isa EnsembleSolution
2020
@test sol.converged
21-
for nlsol in sol
22-
@test nlsol isa NonlinearSolution
23-
@test SciMLBase.successful_retcode(nlsol)
24-
@test nlsol.u[1] 2.0 atol = 1e-7
25-
end
21+
@test sol.u[1] isa NonlinearSolution
22+
@test SciMLBase.successful_retcode(sol.u[1])
23+
@test sol.u[1].u 2.0 atol = 1e-10
24+
@test sol.u[2] isa NonlinearSolution
25+
@test SciMLBase.successful_retcode(sol.u[2])
26+
@test sol.u[2].u 3.0 atol = 1e-10
2627

2728
@testset "no real solutions" begin
2829
prob = NonlinearProblem(1.0, 0.5) do u, p

0 commit comments

Comments
 (0)