From fee77b8ced92fa0b8d29e49a407bd5a2b0b5fb77 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Mon, 11 Dec 2023 21:40:11 -0300 Subject: [PATCH] add some tests --- src/results.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/results.jl b/src/results.jl index e76fb4d7..98641328 100644 --- a/src/results.jl +++ b/src/results.jl @@ -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) @@ -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) @@ -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