Skip to content

Commit

Permalink
Add bigfloat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed May 25, 2024
1 parent 3f37005 commit d4e465a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/misc/exotic_type_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# File for different types of exotic types
@testsetup module NonlinearSolveExoticTypeTests
using NonlinearSolve

fn_iip = NonlinearFunction{true}((du, u, p) -> du .= u .* u .- p)
fn_oop = NonlinearFunction{false}((u, p) -> u .* u .- p)

u0 = BigFloat[1.0, 1.0, 1.0]
prob_iip_bf = NonlinearProblem{true}(fn_iip, u0, BigFloat(2))
prob_oop_bf = NonlinearProblem{false}(fn_oop, u0, BigFloat(2))

export fn_iip, fn_oop, u0, prob_iip_bf, prob_oop_bf
end

@testitem "BigFloat Support" tags=[:misc] setup=[NonlinearSolveExoticTypeTests] begin
using NonlinearSolve, LinearAlgebra

for alg in [NewtonRaphson(), Broyden(), Klement(), DFSane(), TrustRegion(),
LimitedMemoryBroyden(; threshold = 2)]
sol = solve(prob_oop_bf, alg)
@test norm(sol.resid, Inf) < 1e-6
@test SciMLBase.successful_retcode(sol.retcode)

alg isa Halley && continue

sol = solve(prob_iip_bf, alg)
@test norm(sol.resid, Inf) < 1e-6
@test SciMLBase.successful_retcode(sol.retcode)
end
end

0 comments on commit d4e465a

Please sign in to comment.