Skip to content

Commit

Permalink
tests for error handling of undefined dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
LudwigBoess committed Sep 10, 2021
1 parent e2bc9d7 commit da99eae
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ using SPHKernels, Test
d = bias_correction(k, 1.0, 0.0, 0.0, 64)
@test d 1.0
end

@testset "Dimension Error" begin
@test_throws ErrorException("Cubic not defined for 4 dimensions!") Cubic(4)
end
end

@testset "Quintic Spline" begin
Expand Down Expand Up @@ -216,6 +220,10 @@ using SPHKernels, Test
d = bias_correction(k, 1.0, 0.0, 0.0, 64)
@test d 1.0
end

@testset "Dimension Error" begin
@test_throws ErrorException("Quintic not defined for 4 dimensions!") Quintic(4)
end
end

@testset "Wendland C2" begin
Expand Down Expand Up @@ -300,6 +308,10 @@ using SPHKernels, Test

@test d 0.9903494374610865
end

@testset "Dimension Error" begin
@test_throws ErrorException("WendlandC2 not defined for 4 dimensions!") WendlandC2(4)
end
end

@testset "Wendland C4" begin
Expand Down Expand Up @@ -384,6 +396,10 @@ using SPHKernels, Test

@test d 0.9944065039634155
end

@testset "Dimension Error" begin
@test_throws ErrorException("WendlandC4 not defined for 4 dimensions!") WendlandC4(4)
end
end

@testset "Wendland C6" begin
Expand Down Expand Up @@ -468,6 +484,10 @@ using SPHKernels, Test

@test d 0.9943317458482153
end

@testset "Dimension Error" begin
@test_throws ErrorException("WendlandC6 not defined for 4 dimensions!") WendlandC6(4)
end
end

@testset "Wendland C8" begin
Expand Down Expand Up @@ -525,6 +545,11 @@ using SPHKernels, Test

@test d 1.0
end

@testset "Dimension Error" begin
@test_throws ErrorException("WendlandC8 not defined for 1 dimensions!") WendlandC8(1)
@test_throws ErrorException("WendlandC8 not defined for 4 dimensions!") WendlandC8(4)
end
end

@testset "Multiple Dispatch" begin
Expand Down

0 comments on commit da99eae

Please sign in to comment.