TestSpec_PublicAPI_Mean validates that Mean returns the arithmetic mean as described in the package README.md. Specification: "Mean: Returns the arithmetic mean"
(t *testing.T)
| 67 | // |
| 68 | // Specification: "Mean: Returns the arithmetic mean" |
| 69 | func TestSpec_PublicAPI_Mean(t *testing.T) { |
| 70 | var sv StatVar |
| 71 | sv.Add(2.0) |
| 72 | sv.Add(4.0) |
| 73 | sv.Add(6.0) |
| 74 | |
| 75 | assert.InDelta(t, 4.0, sv.Mean(), 1e-9, |
| 76 | "Mean should equal (sum of observations) / count") |
| 77 | } |
| 78 | |
| 79 | // TestSpec_PublicAPI_SampleVariance_SampleFormula validates that SampleVariance |
| 80 | // uses the sample formula with N-1 as the denominator as described in the README.md. |