test(growth): add percentile test

This commit is contained in:
João Paulo Dubas 2024-10-05 12:58:04 +00:00
parent 8c89b55487
commit 1e36c29180
Signed by: joao.dubas
SSH Key Fingerprint: SHA256:V1mixgOGRc/YMhGx/DNkOSmJxgA2vHNrDZEk3wt/kOA

View File

@ -0,0 +1,26 @@
defmodule Growth.Calc.PercentileTest do
@moduledoc false
use ExUnit.Case, async: true
doctest Growth.Calc.Percentile
alias Growth.Calc.Percentile
describe "compute/1" do
for {zscore, percentile} = params <- [
{-3, 0.0013498125},
{-2, 0.0227502617},
{-1, 0.1586553192},
{0, 0.5000000000},
{1, 0.8413446808},
{2, 0.9772497383},
{3, 0.9986501875}
] do
@tag params: params
test "returns the percentile for z-score #{zscore}", %{params: {zscore, percentile}} do
assert_in_delta Percentile.compute(zscore), percentile, 0.0000005
end
end
end
end