Skip to content

Commit

Permalink
complete unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Jul 5, 2024
1 parent 3655e1d commit 7160962
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/equations/inviscid_burgers_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function initial_condition_convergence_test(x, t, equation::InviscidBurgersEquat
c = 2
A = 1
L = 1
f = 1 / L
f = 1.0f0 / L
omega = 2 * convert(RealT, pi) * f
scalar = c + A * sin(omega * (x[1] - t))

Expand All @@ -60,7 +60,7 @@ Source terms used for convergence tests in combination with
c = 2
A = 1
L = 1
f = 1 / L
f = 1.0f0 / L
omega = 2 * convert(RealT, pi) * f
du = omega * A * cos(omega * (x[1] - t)) * (c - 1 + A * sin(omega * (x[1] - t)))

Expand Down
42 changes: 42 additions & 0 deletions test/test_type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,48 @@ isdir(outdir) && rm(outdir, recursive = true)
end
end

@timed_testset "Inviscid Burgers 1D" begin
for RealT in (Float32, Float64)
equations = @inferred InviscidBurgersEquation1D()

x = SVector(zero(RealT))
t = zero(RealT)
u = u_ll = u_rr = SVector(one(RealT))
orientation = 1

@test eltype(@inferred initial_condition_constant(x, t, equations)) == RealT
@test eltype(@inferred initial_condition_convergence_test(x, t, equations)) ==
RealT

@test eltype(@inferred source_terms_convergence_test(u, x, t, equations)) ==
RealT

@test eltype(@inferred flux(u, orientation, equations)) == RealT
@test eltype(@inferred flux_ec(u_ll, u_rr, orientation, equations)) == RealT
@test eltype(@inferred flux_godunov(u_ll, u_rr, orientation, equations)) ==
RealT
@test eltype(@inferred Trixi.flux_engquist_osher(u_ll, u_rr, orientation,
equations)) ==
RealT

@test eltype(eltype(@inferred splitting_lax_friedrichs(u, orientation,
equations))) ==
RealT

@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, orientation, equations)) ==
RealT
@test eltype(@inferred min_max_speed_naive(u_ll, u_rr, orientation, equations)) ==
RealT
@test eltype(@inferred Trixi.max_abs_speeds(u, equations)) ==
RealT
@test eltype(@inferred cons2prim(u, equations)) == RealT
@test eltype(@inferred cons2entropy(u, equations)) == RealT
@test eltype(@inferred entropy2cons(u, equations)) == RealT
@test typeof(@inferred entropy(u, equations)) == RealT
@test typeof(@inferred energy_total(u, equations)) == RealT
end
end

@timed_testset "Linear Scalar Advection 1D" begin
for RealT in (Float32, Float64)
equations = @inferred LinearScalarAdvectionEquation1D(RealT(1))
Expand Down

0 comments on commit 7160962

Please sign in to comment.