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 7dcf9f5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/misc/exotic_type_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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)

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 7dcf9f5

Please sign in to comment.