defmodule Growth.Calc.ZScoreTest do
  @moduledoc false

  use ExUnit.Case, async: true

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

  doctest Growth.Calc.ZScore

  alias Growth.Calc.ZScore

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

        assert_in_delta ZScore.compute(measure, l, m, s), zscore, 0.12
      end
    end
  end
end
