defmodule Growth.Calc.CentileTest do
  @moduledoc false

  use ExUnit.Case, async: true

  import Growth.Data, only: [sample: 0]

  doctest Growth.Calc.Centile

  alias Growth.Calc.Centile

  describe "compute/4" do
    for %{key: key} = params <- sample() do
      @tag params: params
      test "returns the measure given a z-score and box-cox fitted values #{key}", %{
        params: params
      } do
        %{zscore: zscore, measure: measure, l: l, m: m, s: s} = params

        assert_in_delta Centile.compute(zscore, l, m, s), measure, 0.05
      end
    end
  end
end
