Skip to content

Commit 0654c4d

Browse files
committed
add test
1 parent 8a2654e commit 0654c4d

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ julia = "1.6"
3030
[extras]
3131
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
3232
DDEProblemLibrary = "f42792ee-6ffc-4e2a-ae83-8ee2f22de800"
33+
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
3334
ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5"
3435
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
3536
ParameterizedFunctions = "65888b18-ceab-5e60-b2b9-181511a3b968"

src/benchmark.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ end
276276
# Work precision information for a nonlinear problem.
277277
function WorkPrecision(prob::NonlinearProblem, alg, abstols, reltols, dts = nothing; name = nothing, appxsol = nothing, error_estimate = :l2, numruns = 20, seconds = 2, kwargs...)
278278
isnothing(appxsol) && error("Must provide the real value as the \"appxsol\" kwarg.")
279-
println("HERE")
280279

281280
N = length(abstols)
282281
errors = Vector{Float64}(undef, N)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Fetch pakages.
2+
using NonlinearSolve, StaticArrays, DiffEqDevTools, Plots
3+
4+
# Prepares NonlinearProblem.
5+
f(u, p) = u .* u .- p
6+
u0 = @SVector[1.0, 1.0]
7+
p = 2.0
8+
static_prob = NonlinearProblem(f, u0, p)
9+
real_sol = solve(static_prob, NewtonRaphson(), reltol = 1e-15, abstol = 1e-15)
10+
11+
# Sets WP input.
12+
abstols = 1.0 ./ 10.0 .^ (8:12)
13+
reltols = 1.0 ./ 10.0 .^ (8:12)
14+
setups = [Dict(:alg=>NewtonRaphson())
15+
Dict(:alg=>TrustRegion())]
16+
solnames = ["NewtonRaphson";"TrustRegion"]
17+
18+
# Makes WP-diagram
19+
wp = WorkPrecisionSet(static_prob, abstols, reltols, setups; names=solnames, numruns=100, appxsol=real_sol, error_estimate=:l2)
20+
21+
# Checks that all errors are small (they definitely should be).
22+
all(vcat(getfield.(wp.wps, :errors)...) .< 10e-9)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ using Test
99
@time @testset "Analyticless Stochastic WP" begin include("analyticless_stochastic_wp.jl") end
1010
@time @testset "Stability Region Tests" begin include("stability_region_test.jl") end
1111
@time @testset "Plot Recipes" begin include("plotrecipes_tests.jl") end
12+
@time @testset "Plot Recipes (Nonlinearsolve WP-diagrams)" begin include("nonlinearsolve_wpdiagram_tests.jl") end

0 commit comments

Comments
 (0)