From bf69564e35851b037d86e921368bc1d0d6b18ecd Mon Sep 17 00:00:00 2001 From: bennibolm Date: Thu, 16 Nov 2023 17:07:51 +0100 Subject: [PATCH] Add unit test to test default implementation of variable_derivative --- test/test_unit.jl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test_unit.jl b/test/test_unit.jl index d0075e7ac93..6888f62a615 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -1105,6 +1105,26 @@ end end end +@testset "Consistency check for variable_derivative routine" begin + # Set up conservative variables, equations + u = [ + 0.5011914484393387, + 0.8829127712445113, + 0.43024132987932817, + 0.7560616633050348, + ] + + equations = CompressibleEulerEquations2D(1.4) + + # Define wrapper function for pressure in order to call default implementation + function pressure_test(u, equations) + return pressure(u, equations) + end + + @test Trixi.variable_derivative(pressure_test, u, equations) ≈ + Trixi.variable_derivative(pressure, u, equations) +end + @testset "Equivalent Fluxes" begin # Set up equations and dummy conservative variables state # Burgers' Equation