diff --git a/test/test_2d.jl b/test/test_2d.jl index 33c5570..4762d4d 100644 --- a/test/test_2d.jl +++ b/test/test_2d.jl @@ -3,18 +3,20 @@ module Test2D using Test using Trixi2Vtk +include("test_trixi2vtk.jl") + # Start with a clean environment: remove Trixi output directory if it exists outdir = "out" isdir(outdir) && rm(outdir, recursive=true) @testset "2D" begin - run_trixi("2d/parameters.toml", n_steps_max=1) + run_trixi("parameters.toml", n_steps_max=1) @testset "uniform mesh" begin - test_trixi2vtk("solution_000000.h5", outdir, - hashes=[("solution_000000.vtu", "56ba70356fd6761432cd43d807c91961b3e7832e"), - ("solution_000000_celldata.vtu", "318de9b537e9724c190c4499e4cf8dca50ffff14")]) + test_trixi2vtk_run("solution_000000.h5", outdir, + hashes=[("solution_000000.vtu", "1ec2c93c0c9c4f4992dea54afaf2a348ece0160e"), + ("solution_000000_celldata.vtu", "e396c3ba63276347966d4264cf0f52d592221830")]) end end diff --git a/test/test_trixi2vtk.jl b/test/test_trixi2vtk.jl index b90420f..531a98a 100644 --- a/test/test_trixi2vtk.jl +++ b/test/test_trixi2vtk.jl @@ -7,26 +7,26 @@ using Trixi2Vtk const EXAMPLES_DIR = joinpath(pathof(Trixi) |> dirname |> dirname, "examples") -function run_trixi(parameters_file, parameters...) +function run_trixi(parameters_file; parameters...) @test_nowarn Trixi.run(joinpath(EXAMPLES_DIR, parameters_file); parameters...) end function sha1file(filename) open(filename) do f - hash = bytes2hex(sha1(f)) + bytes2hex(sha1(f)) end - - return hash end function test_trixi2vtk_run(filenames, outdir; hashes=nothing, kwargs...) - @test_nowarn Trixi2Vtk.run(filenames, output_directory=outdir, kwargs...) + @test_nowarn Trixi2Vtk.run(filename=joinpath(outdir, filenames), + output_directory=outdir, kwargs...) if !isnothing(hashes) - for filename, hash in hashes - @test hash == sha1file(joinpath(outdir, filename)) + for (filename, hash_expected) in hashes + hash_measured = sha1file(joinpath(outdir, filename)) + @test hash_expected == hash_measured end end end