Skip to content

Commit 058b65e

Browse files
Merge pull request #99 from SKopecz/stuff
fix error message in test_convergence without analytical solution
2 parents b60bd7f + 7e53532 commit 058b65e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/convergence.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ function ConvergenceSimulation(solutions, convergence_axis;
1414
uEltype = eltype(solutions[1].u[1])
1515
errors = Dict() #Should add type information
1616
if expected_value == nothing
17-
if isempty(solutions[1].errors)
18-
error("Errors dictionary is empty. No analytical solution set.")
17+
if isnothing(solutions[1].errors) || isempty(solutions[1].errors)
18+
error("Errors dictionary is empty. No analytical solution set. If you used `test_convergence` you may consider `analyticless_test_convergence` instead.")
1919
end
2020
for k in keys(solutions[1].errors)
2121
errors[k] = [mean(sol.errors[k]) for sol in solutions]

test/analyticless_convergence_tests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ test_setup = Dict(:alg => Vern9(), :reltol => 1e-25, :abstol => 1e-25)
1414
sim1 = analyticless_test_convergence(dts, prob, Tsit5(), test_setup)
1515
sim2 = analyticless_test_convergence(dts, prob, Vern9(), test_setup)
1616

17+
if VERSION >= v"1.8"
18+
@test_throws "No analytical solution set." test_convergence(dts, prob, Tsit5())
19+
end
20+
1721
@test abs(sim1.𝒪est[:final] - 5) < 0.2
1822
@test abs(sim2.𝒪est[:final] - 9) < 0.2
1923

0 commit comments

Comments
 (0)