Skip to content

Commit a17a412

Browse files
committed
Add benchmarks to tests
1 parent 4f697fd commit a17a412

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

test/benchmarks.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Check that all benchmarks are running without errors.
2+
# Note that these are only smoke tests, not verifying the result.
3+
# Also note that these tests are run without coverage checks, since we want to
4+
# cover everything with unit tests.
5+
@testset verbose=true "Benchmarks" begin
6+
include("../benchmarks/benchmarks.jl")
7+
8+
@testset verbose=true "$(length(size))D" for size in [(50,), (10, 10), (5, 5, 5)]
9+
@testset verbose=true "`benchmark_count_neighbors`" begin
10+
@test_nowarn_mod plot_benchmarks(benchmark_count_neighbors, size, 2)
11+
end
12+
13+
@testset verbose=true "`benchmark_n_body`" begin
14+
@test_nowarn_mod plot_benchmarks(benchmark_n_body, size, 2)
15+
end
16+
end
17+
end;

test/runtests.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
include("test_util.jl")
22

3+
const POINTNEIGHBORS_TEST = lowercase(get(ENV, "POINTNEIGHBORS_TEST", "all"))
4+
35
@testset verbose=true "PointNeighbors.jl Tests" begin
4-
include("nhs_trivial.jl")
5-
include("nhs_grid.jl")
6-
include("neighborhood_search.jl")
7-
end
6+
if POINTNEIGHBORS_TEST in ("all", "unit")
7+
include("unittest.jl")
8+
end
9+
10+
if POINTNEIGHBORS_TEST in ("all", "benchmarks")
11+
include("benchmarks.jl")
12+
end
13+
end;

test/unittest.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Separate file that can be executed to only run unit tests.
2+
# Include `test_util.jl` first.
3+
@testset verbose=true "Unit Tests" begin
4+
include("nhs_trivial.jl")
5+
include("nhs_grid.jl")
6+
include("neighborhood_search.jl")
7+
end;

0 commit comments

Comments
 (0)