Skip to content

Commit 302a9e6

Browse files
Use TrixiTest.jl testing macros (#104)
* change to TrixiTest * use package local test_trixi_include --------- Co-authored-by: Joshua Lampert <[email protected]>
1 parent 20e069e commit 302a9e6

9 files changed

+55
-219
lines changed

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ OrdinaryDiffEqLowStorageRK = "1.2"
1616
OrdinaryDiffEqSSPRK = "1.2"
1717
Test = "1"
1818
Trixi = "0.13"
19-
TrixiTest = "0.1"
19+
TrixiTest = "0.1.2"

test/test_2d_moist_euler.jl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module TestExamples2DMoistEuler
22

3-
using Test
4-
using TrixiAtmo
5-
63
include("test_trixiatmo.jl")
74

8-
EXAMPLES_DIR = TrixiAtmo.examples_dir()
9-
10-
@trixiatmo_testset "elixir_moist_euler_dry_bubble" begin
5+
@trixi_testset "elixir_moist_euler_dry_bubble" begin
116
@test_trixi_include(joinpath(EXAMPLES_DIR,
127
"elixir_moist_euler_dry_bubble.jl"),
138
l2=[
@@ -37,7 +32,7 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir()
3732
end
3833
end
3934

40-
@trixiatmo_testset "elixir_moist_euler_EC_bubble" begin
35+
@trixi_testset "elixir_moist_euler_EC_bubble" begin
4136
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_moist_euler_EC_bubble.jl"),
4237
l2=[
4338
0.01345154393018332,
@@ -68,7 +63,7 @@ end
6863
end
6964
end
7065

71-
@trixiatmo_testset "elixir_moist_euler_moist_bubble" begin
66+
@trixi_testset "elixir_moist_euler_moist_bubble" begin
7267
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_moist_euler_moist_bubble.jl"),
7368
l2=[
7469
7.351043427240923e-6,
@@ -99,7 +94,7 @@ end
9994
end
10095
end
10196

102-
@trixiatmo_testset "elixir_moist_euler_nonhydrostatic_gravity_waves" begin
97+
@trixi_testset "elixir_moist_euler_nonhydrostatic_gravity_waves" begin
10398
@test_trixi_include(joinpath(EXAMPLES_DIR,
10499
"elixir_moist_euler_nonhydrostatic_gravity_waves.jl"),
105100
l2=[
@@ -131,7 +126,7 @@ end
131126
end
132127
end
133128

134-
@trixiatmo_testset "elixir_moist_euler_source_terms_dry" begin
129+
@trixi_testset "elixir_moist_euler_source_terms_dry" begin
135130
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_moist_euler_source_terms_dry.jl"),
136131
l2=[
137132
1.3992076791281227e-5,
@@ -162,7 +157,7 @@ end
162157
end
163158
end
164159

165-
@trixiatmo_testset "elixir_moist_euler_source_terms_moist" begin
160+
@trixi_testset "elixir_moist_euler_source_terms_moist" begin
166161
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_moist_euler_source_terms_moist.jl"),
167162
l2=[
168163
1.8307663991129928e-5,
@@ -193,7 +188,7 @@ end
193188
end
194189
end
195190

196-
@trixiatmo_testset "elixir_moist_euler_source_terms_split_moist" begin
191+
@trixi_testset "elixir_moist_euler_source_terms_split_moist" begin
197192
@test_trixi_include(joinpath(EXAMPLES_DIR,
198193
"elixir_moist_euler_source_terms_split_moist.jl"),
199194
l2=[

test/test_2d_shallow_water_covariant.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module TestShallowWaterCovariant
22

3-
using Test
4-
using TrixiAtmo
5-
63
include("test_trixiatmo.jl")
74

8-
EXAMPLES_DIR = TrixiAtmo.examples_dir()
9-
10-
@trixiatmo_testset "elixir_shallowwater_covariant_geostrophic_balance" begin
5+
@trixi_testset "elixir_shallowwater_covariant_geostrophic_balance" begin
116
@test_trixi_include(joinpath(EXAMPLES_DIR,
127
"elixir_shallowwater_covariant_geostrophic_balance.jl"),
138
l2=[
@@ -33,7 +28,7 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir()
3328
end
3429
end
3530

36-
@trixiatmo_testset "elixir_shallowwater_covariant_rossby_haurwitz" begin
31+
@trixi_testset "elixir_shallowwater_covariant_rossby_haurwitz" begin
3732
@test_trixi_include(joinpath(EXAMPLES_DIR,
3833
"elixir_shallowwater_covariant_rossby_haurwitz.jl"),
3934
l2=[265.9818260977567, 0.17644364627357362, 0.2535621726719579],
@@ -52,7 +47,7 @@ end
5247
end
5348
end
5449

55-
@trixiatmo_testset "elixir_shallowwater_covariant_isolated_mountain" begin
50+
@trixi_testset "elixir_shallowwater_covariant_isolated_mountain" begin
5651
@test_trixi_include(joinpath(EXAMPLES_DIR,
5752
"elixir_shallowwater_covariant_isolated_mountain.jl"),
5853
l2=[13.18894432799001, 0.005698447961168719, 0.007624217062402512],
@@ -70,7 +65,7 @@ end
7065
end
7166
end
7267

73-
@trixiatmo_testset "elixir_shallowwater_covariant_unsteady_solid_body_rotation_EC" begin
68+
@trixi_testset "elixir_shallowwater_covariant_unsteady_solid_body_rotation_EC" begin
7469
@test_trixi_include(joinpath(EXAMPLES_DIR,
7570
"elixir_shallowwater_covariant_unsteady_solid_body_rotation_EC.jl"),
7671
l2=[
@@ -98,7 +93,7 @@ end
9893
end
9994
end
10095

101-
@trixiatmo_testset "elixir_shallowwater_covariant_barotropic_instability" begin
96+
@trixi_testset "elixir_shallowwater_covariant_barotropic_instability" begin
10297
@test_trixi_include(joinpath(EXAMPLES_DIR,
10398
"elixir_shallowwater_covariant_barotropic_instability.jl"),
10499
l2=[21.08826693663232, 0.03006187671520436, 0.023421745045307123],
@@ -116,7 +111,7 @@ end
116111
end
117112
end
118113

119-
@trixiatmo_testset "elixir_shallowwater_covariant_well_balanced" begin
114+
@trixi_testset "elixir_shallowwater_covariant_well_balanced" begin
120115
@test_trixi_include(joinpath(EXAMPLES_DIR,
121116
"elixir_shallowwater_covariant_well_balanced.jl"),
122117
l2=[0.0, 0.0, 0.0], linf=[0.0, 0.0, 0.0],

test/test_3d_shallow_water.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module TestShallowWaterCartesian
22

3-
using Test
4-
using TrixiAtmo
5-
63
include("test_trixiatmo.jl")
74

8-
EXAMPLES_DIR = TrixiAtmo.examples_dir()
9-
10-
@trixiatmo_testset "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_correction" begin
5+
@trixi_testset "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_correction" begin
116
@test_trixi_include(joinpath(EXAMPLES_DIR,
127
"elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_correction.jl"),
138
l2=[
@@ -37,7 +32,7 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir()
3732
end
3833
end
3934

40-
@trixiatmo_testset "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection" begin
35+
@trixi_testset "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection" begin
4136
@test_trixi_include(joinpath(EXAMPLES_DIR,
4237
"elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"),
4338
l2=[
@@ -67,7 +62,7 @@ end
6762
end
6863
end
6964

70-
@trixiatmo_testset "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection (ES)" begin
65+
@trixi_testset "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection (ES)" begin
7166
@test_trixi_include(joinpath(EXAMPLES_DIR,
7267
"elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"),
7368
l2=[
@@ -100,7 +95,7 @@ end
10095
end
10196
end
10297

103-
@trixiatmo_testset "elixir_shallowwater_cartesian_well_balanced" begin
98+
@trixi_testset "elixir_shallowwater_cartesian_well_balanced" begin
10499
@test_trixi_include(joinpath(EXAMPLES_DIR,
105100
"elixir_shallowwater_cartesian_well_balanced.jl"),
106101
l2=[0.0, 0.0, 0.0, 0.0, 0.0],
@@ -116,7 +111,7 @@ end
116111
end
117112
end
118113

119-
@trixiatmo_testset "elixir_shallowwater_cartesian_geostrophic_balance (naive)" begin
114+
@trixi_testset "elixir_shallowwater_cartesian_geostrophic_balance (naive)" begin
120115
@test_trixi_include(joinpath(EXAMPLES_DIR,
121116
"elixir_shallowwater_cartesian_geostrophic_balance.jl"),
122117
l2=[0.27676841776660904,
@@ -144,7 +139,7 @@ end
144139
end
145140
end
146141

147-
@trixiatmo_testset "elixir_shallowwater_cartesian_isolated_mountain" begin
142+
@trixi_testset "elixir_shallowwater_cartesian_isolated_mountain" begin
148143
@test_trixi_include(joinpath(EXAMPLES_DIR,
149144
"elixir_shallowwater_cartesian_isolated_mountain.jl"),
150145
l2=[

test/test_mpi.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module TestMPI
22

3-
using Test
4-
using TrixiAtmo
3+
using Trixi: Trixi
54

65
include("test_trixiatmo.jl")
76

@@ -16,12 +15,10 @@ Trixi.MPI.Barrier(Trixi.mpi_comm())
1615
# https://docs.github.com/en/actions/learn-github-actions/environment-variables
1716
CI_ON_WINDOWS = (get(ENV, "GITHUB_ACTIONS", false) == "true") && Sys.iswindows()
1817

19-
EXAMPLES_DIR = pkgdir(TrixiAtmo, "examples")
20-
2118
@testset "MPI tests" begin
2219
#! format: noindent
2320

24-
@trixiatmo_testset "elixir_moist_euler_moist_bubble" begin
21+
@trixi_testset "elixir_moist_euler_moist_bubble" begin
2522
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_moist_euler_dry_bubble.jl"),
2623
l2=[
2724
9.103834949215729e-7,

test/test_spherical_advection.jl

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
module TestSphericalAdvection
22

3-
using Test
4-
using TrixiAtmo
5-
63
include("test_trixiatmo.jl")
74

8-
EXAMPLES_DIR = TrixiAtmo.examples_dir()
9-
10-
@trixiatmo_testset "Spherical advection (cubed sphere), Cartesian weak form, LLF surface flux" begin
5+
@trixi_testset "Spherical advection (cubed sphere), Cartesian weak form, LLF surface flux" begin
116
@test_trixi_include(joinpath(EXAMPLES_DIR,
127
"elixir_shallowwater_cartesian_advection_cubed_sphere.jl"),
138
l2=[
@@ -35,7 +30,7 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir()
3530
end
3631
end
3732

38-
@trixiatmo_testset "Spherical advection (quad icosahedron), Cartesian weak form, LLF surface flux" begin
33+
@trixi_testset "Spherical advection (quad icosahedron), Cartesian weak form, LLF surface flux" begin
3934
@test_trixi_include(joinpath(EXAMPLES_DIR,
4035
"elixir_shallowwater_cartesian_advection_quad_icosahedron.jl"),
4136
l2=[
@@ -63,7 +58,7 @@ end
6358
end
6459
end
6560

66-
@trixiatmo_testset "Spherical advection, Cartesian weak form, element-local mapping" begin
61+
@trixi_testset "Spherical advection, Cartesian weak form, element-local mapping" begin
6762
@test_trixi_include(joinpath(EXAMPLES_DIR,
6863
"elixir_shallowwater_cartesian_advection_cubed_sphere.jl"),
6964
l2=[
@@ -91,7 +86,7 @@ end
9186
end
9287
end
9388

94-
@trixiatmo_testset "Spherical advection, covariant weak form, LLF surface flux" begin
89+
@trixi_testset "Spherical advection, covariant weak form, LLF surface flux" begin
9590
@test_trixi_include(joinpath(EXAMPLES_DIR,
9691
"elixir_spherical_advection_covariant_cubed_sphere.jl"),
9792
l2=[1.0007043506351705, 0.0, 0.0],
@@ -106,7 +101,7 @@ end
106101
end
107102
end
108103

109-
@trixiatmo_testset "Spherical advection, covariant weak form, LLF surface flux, global spherical coords" begin
104+
@trixi_testset "Spherical advection, covariant weak form, LLF surface flux, global spherical coords" begin
110105
@test_trixi_include(joinpath(EXAMPLES_DIR,
111106
"elixir_spherical_advection_covariant_cubed_sphere.jl"),
112107
l2=[1.0007043506351705, 0.0, 0.0],
@@ -124,7 +119,7 @@ end
124119

125120
# The covariant flux-differencing form should be equivalent to the weak form when the
126121
# arithmetic mean is used as the two-point flux
127-
@trixiatmo_testset "Spherical advection, covariant flux-differencing, central/LLF" begin
122+
@trixi_testset "Spherical advection, covariant flux-differencing, central/LLF" begin
128123
@test_trixi_include(joinpath(EXAMPLES_DIR,
129124
"elixir_spherical_advection_covariant_cubed_sphere.jl"),
130125
l2=[1.0007043506351412, 0.0, 0.0],
@@ -141,7 +136,7 @@ end
141136
end
142137

143138
# Version with arithmetic mean used for both the volume and surface fluxes
144-
@trixiatmo_testset "Spherical advection, covariant flux-differencing, central/central" begin
139+
@trixi_testset "Spherical advection, covariant flux-differencing, central/central" begin
145140
@test_trixi_include(joinpath(EXAMPLES_DIR,
146141
"elixir_spherical_advection_covariant_cubed_sphere.jl"),
147142
l2=[2.499889861385917, 0.0, 0.0],
@@ -158,7 +153,7 @@ end
158153
end
159154
end
160155

161-
@trixiatmo_testset "Spherical advection on icosahedral grid, covariant weak form, LLF surface flux" begin
156+
@trixi_testset "Spherical advection on icosahedral grid, covariant weak form, LLF surface flux" begin
162157
@test_trixi_include(joinpath(EXAMPLES_DIR,
163158
"elixir_spherical_advection_covariant_quad_icosahedron.jl"),
164159
l2=[0.5183886767005157, 0.0, 0.0],

test/test_threaded.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
module TestThreaded
22

3-
using Test
4-
using TrixiAtmo
5-
6-
include("test_trixiatmo.jl") # TODO - This is a repetition from Trixi.jl
7-
8-
EXAMPLES_DIR = pkgdir(TrixiAtmo, "examples")
3+
include("test_trixiatmo.jl")
94

105
@testset "Threaded tests" begin
116
#! format: noindent
127

13-
@trixiatmo_testset "elixir_moist_euler_moist_bubble" begin
8+
@trixi_testset "elixir_moist_euler_moist_bubble" begin
149
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_moist_euler_moist_bubble.jl"),
1510
l2=[
1611
7.351043427240923e-6,

test/test_trixi_consistency.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ module TestTrixiConsistency
22

33
include("test_trixiatmo.jl")
44

5-
EXAMPLES_DIR = TrixiAtmo.examples_dir()
6-
75
# Start with a clean environment: remove Trixi.jl output directory if it exists
86
outdir = "out"
97
isdir(outdir) && rm(outdir, recursive = true)
108

11-
@trixiatmo_testset "Dry air consistency check" begin
9+
@trixi_testset "Dry air consistency check" begin
10+
using Trixi
11+
using TrixiAtmo: CompressibleMoistEulerEquations2D
12+
1213
# Dry air warm bubble test case in Trixi.jl
1314
maxiters = 100
1415
trixi_elixir = joinpath(Trixi.examples_dir(), "tree_2d_dgsem",
@@ -38,7 +39,7 @@ isdir(outdir) && rm(outdir, recursive = true)
3839
end
3940

4041
# Now use the elixir in TrixiAtmo
41-
elixir_atmo = joinpath(TrixiAtmo.examples_dir(), "elixir_moist_euler_dry_bubble.jl")
42+
elixir_atmo = joinpath(EXAMPLES_DIR, "elixir_moist_euler_dry_bubble.jl")
4243

4344
# Override initial condition, maxiters
4445
trixi_include(elixir_atmo,

0 commit comments

Comments
 (0)