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, _} = 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
