diff --git a/src/macros.jl b/src/macros.jl index 216f665..9abe876 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -67,10 +67,10 @@ macro test_trixi_include_base(elixir, args...) # Note: The variables below are just Symbols, not actual errors/types local l2 = get_kwarg(args, :l2, nothing) local linf = get_kwarg(args, :linf, nothing) - local RealT_symbol = get_kwarg(args, :RealT, :Float64) - RealT = getfield(@__MODULE__, RealT_symbol) - atol_default = 500 * eps(RealT) - rtol_default = sqrt(eps(RealT)) + local RealT_symbol = get_kwarg(args, :RealT_for_test_tolerances, :Float64) + RealT_for_test_tolerances = getfield(@__MODULE__, RealT_symbol) + atol_default = 500 * eps(RealT_for_test_tolerances) + rtol_default = sqrt(eps(RealT_for_test_tolerances)) local atol = get_kwarg(args, :atol, atol_default) local rtol = get_kwarg(args, :rtol, rtol_default) diff --git a/test/test_test_trixi_include.jl b/test/test_test_trixi_include.jl index 1418077..bc3e22a 100644 --- a/test/test_test_trixi_include.jl +++ b/test/test_test_trixi_include.jl @@ -193,6 +193,24 @@ end end end + @trixi_testset "l2 and linf with RealT_for_test_tolerances" begin + example = """ + function analysis_callback(sol) + @show sol + return sol[1], sol[2] + end + sol = [1.2345678901234567, 7.6543210987654321] + """ + + mktemp() do path, io + write(io, example) + close(io) + + @test_trixi_include_base(path, l2=1.2345, linf=7.6543, + RealT_for_test_tolerances=Float32) + end + end + @trixi_testset "maxiters" begin example = """ maxiters = 4 @@ -208,8 +226,6 @@ end end end - # RealT is used internally to compute error tolerances when l2 or linf are used - # However, it should also be forwarded as a keyword argument to trixi_include @trixi_testset "RealT" begin example = """ RealT = Float64