Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Dec 12, 2023
1 parent 1ed2ef7 commit fee77b8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ function sphericalshellvolume(i, step)
return (4 * pi / 3) * ((rmin + step)^3 - rmin^3)
end

@testitem "sphericalshellvolume" begin
@test sphericalshellvolume(1, 1.0) 4 * pi / 3
@test sphericalshellvolume(2, 1.0) 4 * pi / 3 * (8 - 1)
@test sphericalshellvolume(3, 1.0) 4 * pi / 3 * (27 - 8)
end

"""
shellradius(i,step)
Expand All @@ -316,6 +322,10 @@ function shellradius(i, step)
return (0.5 * ((rmin + step)^3 + rmin^3))^(1 / 3)
end

@testitem "shellradius" begin
@test shellradius(1, 0.1) 0.07937005259840998
@test shellradius(5, 0.3) 1.3664650373440481
end

"""
sphereradiusfromshellvolume(volume,step)
Expand All @@ -334,6 +344,11 @@ function sphereradiusfromshellvolume(volume, step)
return (0.5 * (volume / fourthirdsofpi + 2 * rmin^3))^(1 / 3)
end

@testitem "sphereradiusfromshellvolume" begin
@test sphereradiusfromshellvolume(1.0, 0.2) 0.03351032163829113
@test sphereradiusfromshellvolume(100.0, 0.1) = 124.4112578723602
end

#
# Function to compute the normalization of the weights, given the optional
# frame weights and the number of frames read, which is used in the case
Expand Down

0 comments on commit fee77b8

Please sign in to comment.