Skip to content

Commit

Permalink
Added @allocated test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Markert committed Aug 31, 2023
1 parent 488ee97 commit 80fe0e6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
33 changes: 20 additions & 13 deletions test/test_t8code_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ isdir(outdir) && rm(outdir, recursive = true)
mkdir(outdir)

@testset "T8codeMesh2D" begin

@trixi_testset "test save_mesh_file" begin
@test_throws Exception begin
# Save mesh file support will be added in the future. The following
# lines of code are here for satisfying code coverage.

# Create dummy mesh.
mesh = T8codeMesh((1, 1), polydeg = 1,
mapping = Trixi.coordinates2mapping((-1.0, -1.0), ( 1.0, 1.0)),
initial_refinement_level = 1)

# This call throws an error.
Trixi.save_mesh_file(mesh, "dummy")
end
@test_throws Exception begin
# Save mesh file support will be added in the future. The following
# lines of code are here for satisfying code coverage.

# Create dummy mesh.
mesh = T8codeMesh((1, 1), polydeg = 1,
mapping = Trixi.coordinates2mapping((-1.0, -1.0), (1.0, 1.0)),
initial_refinement_level = 1)

# This call throws an error.
Trixi.save_mesh_file(mesh, "dummy")
end
end

@trixi_testset "elixir_advection_basic.jl" begin
Expand All @@ -41,6 +40,14 @@ mkdir(outdir)
"elixir_advection_nonconforming_flag.jl"),
l2=[3.198940059144588e-5],
linf=[0.00030636069494005547])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_advection_unstructured_flag.jl" begin
Expand Down
8 changes: 8 additions & 0 deletions test/test_t8code_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ mkdir(outdir)
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_nonconforming.jl"),
l2=[0.00253595715323843],
linf=[0.016486952252155795])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_advection_amr.jl" begin
Expand Down

0 comments on commit 80fe0e6

Please sign in to comment.