Skip to content

Commit

Permalink
Fix testing (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
sloede committed Aug 26, 2020
1 parent 6e17789 commit 35c9316
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions test/test_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions test/test_trixi2vtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 comments on commit 35c9316

@sloede
Copy link
Member Author

@sloede sloede commented on 35c9316 Aug 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/20210

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 35c9316e051e32b6539874570c6c0733460073ab
git push origin v0.1.0

Please sign in to comment.