Skip to content

Commit 9727dd6

Browse files
Merge #94
94: Refactor tests r=charleskawczynski a=charleskawczynski This PR refactors the testsets by: - Moving some tests into ``@safetestset`s` - Removing some unused files/functions Co-authored-by: Charles Kawczynski <[email protected]>
2 parents 0463e8a + 83906c3 commit 9727dd6

File tree

4 files changed

+12
-35
lines changed

4 files changed

+12
-35
lines changed

test/aqua.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Aqua
22
using Test
3+
using ClimaTimeSteppers
34

45
@testset "Aqua tests - unbound args" begin
56
# This tests that we don't accidentally run into

test/runtests.jl

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,15 @@ else
77
end
88

99
@safetestset "SparseContainers" begin include("sparse_containers.jl") end
10-
include("testhelper.jl")
10+
@safetestset "Newtons method" begin include("test_newtons_method.jl") end
11+
@safetestset "Single column ARS" begin include("single_column_ARS_test.jl") end
12+
@safetestset "Aqua" begin include("aqua.jl") end
13+
1114
include("problems.jl")
1215
include("utils.jl")
1316

1417
include("integrator.jl")
1518
include("convergence.jl")
1619
include("callbacks.jl")
1720
include("test_convergence_checker.jl")
18-
include("test_newtons_method.jl")
19-
include("single_column_ARS_test.jl")
2021
include("compare_generated.jl") # TODO: Remove this.
21-
include("aqua.jl")
22-
23-
#=
24-
@testset "ODE Tests: Basic" begin
25-
runmpi(joinpath(@__DIR__, "basic.jl"))
26-
end
27-
=#
28-
# FIXME: Should consolodate all convergence tests into single
29-
# testset --- this test is slightly redundant
30-
# @testset "ODE Tests: Convergence" begin
31-
# runmpi(joinpath(@__DIR__, "ode_tests_convergence.jl"))
32-
# end

test/single_column_ARS_test.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ end
198198
spatial_residual!(du, u, ss, 0.0)
199199

200200
end
201-
function jac_imp(J, u)
201+
function jac_imp(J, u)
202202
jacobian!(J, u, ss, 0.0)
203203
end
204204

@@ -236,7 +236,7 @@ end
236236
0 (1-γ)/2 γ 0;
237237
0 b1 b2 γ;]
238238
b_imp = [0, b1, b2, γ]
239-
239+
240240

241241
n_stage = size(a_imp)[1] - 1
242242
K_exp = zeros(3*N+1, n_stage + 1)
@@ -246,14 +246,14 @@ end
246246
u_stage = copy(u)
247247
for i_stage = 1:n_stage
248248
f_exp(@view(K_exp[:, i_stage]), u_stage)
249-
u_stage_temp = u + dt*(K_imp[:, 1:i_stage-1]*a_imp[i_stage+1, 2:i_stage]
249+
u_stage_temp = u + dt*(K_imp[:, 1:i_stage-1]*a_imp[i_stage+1, 2:i_stage]
250250
+ K_exp[:, 1:i_stage]*a_exp[i_stage+1, 1:i_stage])
251251

252252
K_imp[:, i_stage] = f_imp_solve(f_imp, jac_imp, u_stage_temp, dt*a_imp[i_stage+1, i_stage+1])
253-
u_stage = u_stage_temp + dt*K_imp[:, i_stage]*a_imp[i_stage+1, i_stage+1]
253+
u_stage = u_stage_temp + dt*K_imp[:, i_stage]*a_imp[i_stage+1, i_stage+1]
254254
end
255255
f_exp(@view(K_exp[:, n_stage+1]), u_stage)
256-
u .+= dt*(K_exp[:, 1:n_stage+1]*b_exp[1:n_stage+1] + K_imp[:, 1:n_stage]*b_imp[2:n_stage+1])
256+
u .+= dt*(K_exp[:, 1:n_stage+1]*b_exp[1:n_stage+1] + K_imp[:, 1:n_stage]*b_imp[2:n_stage+1])
257257
end
258258
ref_ARS343 = norm(u)
259259
end
@@ -271,7 +271,7 @@ end
271271
ARS222(NewtonsMethod(; max_iters = 1)),
272272
ARS343(NewtonsMethod(; max_iters = 1)),
273273
)
274-
reference_sol_norm = [860.2745315698107; 860.2745315698107; 860.4393569534262;
274+
reference_sol_norm = [860.2745315698107; 860.2745315698107; 860.4393569534262;
275275
860.452530117785; 860.452530117785; ref_ARS343]
276276

277277

@@ -289,7 +289,7 @@ end
289289
),
290290
copy(u0),(0.0, N_iter*dt), ss)
291291

292-
292+
293293
u = solve(single_column_prob_wfact_split , algo; dt=dt)
294294
@info norm(u.u[end])
295295
@test norm(u.u[end]) reference_sol_norm[i] atol = 1e3eps()

test/testhelper.jl

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)