Skip to content

Commit

Permalink
Add benchmarks to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
efaulhaber committed May 21, 2024
1 parent 4f697fd commit a17a412
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
17 changes: 17 additions & 0 deletions test/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Check that all benchmarks are running without errors.
# Note that these are only smoke tests, not verifying the result.
# Also note that these tests are run without coverage checks, since we want to
# cover everything with unit tests.
@testset verbose=true "Benchmarks" begin
include("../benchmarks/benchmarks.jl")

@testset verbose=true "$(length(size))D" for size in [(50,), (10, 10), (5, 5, 5)]
@testset verbose=true "`benchmark_count_neighbors`" begin
@test_nowarn_mod plot_benchmarks(benchmark_count_neighbors, size, 2)
end

@testset verbose=true "`benchmark_n_body`" begin
@test_nowarn_mod plot_benchmarks(benchmark_n_body, size, 2)
end
end
end;
14 changes: 10 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
include("test_util.jl")

const POINTNEIGHBORS_TEST = lowercase(get(ENV, "POINTNEIGHBORS_TEST", "all"))

@testset verbose=true "PointNeighbors.jl Tests" begin
include("nhs_trivial.jl")
include("nhs_grid.jl")
include("neighborhood_search.jl")
end
if POINTNEIGHBORS_TEST in ("all", "unit")
include("unittest.jl")
end

if POINTNEIGHBORS_TEST in ("all", "benchmarks")
include("benchmarks.jl")
end
end;
7 changes: 7 additions & 0 deletions test/unittest.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Separate file that can be executed to only run unit tests.
# Include `test_util.jl` first.
@testset verbose=true "Unit Tests" begin
include("nhs_trivial.jl")
include("nhs_grid.jl")
include("neighborhood_search.jl")
end;

0 comments on commit a17a412

Please sign in to comment.