test(growth): add percentile test
This commit is contained in:
parent
8c89b55487
commit
1e36c29180
26
test/growth/calc/percentile_test.exs
Normal file
26
test/growth/calc/percentile_test.exs
Normal 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
|
Loading…
x
Reference in New Issue
Block a user