Skip to content

Commit b92befb

Browse files
author
Michele Mesiti
committed
ABM algs: refactor regr/thread tests for clarity
1 parent 102e447 commit b92befb

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed
Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
using OrdinaryDiffEqAdamsBashforthMoulton, ODEProblemLibrary
2+
import OrdinaryDiffEqCore: OrdinaryDiffEqAdaptiveAlgorithm
23
using Test
34
using Static
45

5-
free_timestep_algorithms = [VCAB3, VCAB4, VCAB5, VCABM3, VCABM4, VCABM5, VCABM]
6-
7-
fixed_timestep_algorithms = [AB3, AB4, AB5, ABM32, ABM43, ABM54]
6+
algorithms = [
7+
AB3, AB4, AB5, ABM32, ABM43, ABM54, VCAB3, VCAB4, VCAB5, VCABM3, VCABM4, VCABM5, VCABM]
88

99
problem = ODEProblemLibrary.prob_ode_linear
1010

11-
function test_alg(ALG; kwargs...)
12-
sol_thread = solve(problem, ALG(Static.True()); kwargs...)
13-
sol_nothread = solve(problem, ALG(Static.False()); kwargs...)
14-
15-
@test all(sol_nothread .== sol_thread)
16-
end
17-
1811
@testset "Regression test for threading versions vs non threading versions" begin
19-
@testset "$ALG" for ALG in fixed_timestep_algorithms
20-
test_alg(ALG, dt = 1 // 2^9)
21-
end
22-
@testset "$ALG" for ALG in free_timestep_algorithms
23-
test_alg(ALG)
12+
@testset "$ALG" for ALG in algorithms
13+
if ALG isa OrdinaryDiffEqAdaptiveAlgorithm
14+
sol_thread = solve(problem, ALG(Static.True()))
15+
sol_nothread = solve(problem, ALG(Static.False()))
16+
else
17+
sol_thread = solve(problem, ALG(Static.True()), dt = 1 // 2^9)
18+
sol_nothread = solve(problem, ALG(Static.False()), dt = 1 // 2^9)
19+
end
20+
@test all(sol_nothread .== sol_thread)
2421
end
2522
end

0 commit comments

Comments
 (0)