TestSpec_PublicAPI_MinMax validates that Min and Max track the extreme observed values as described in the package README.md. Specification: - Min: "Returns the minimum observed value" - Max: "Returns the maximum observed value"
(t *testing.T)
| 50 | // - Min: "Returns the minimum observed value" |
| 51 | // - Max: "Returns the maximum observed value" |
| 52 | func TestSpec_PublicAPI_MinMax(t *testing.T) { |
| 53 | var sv StatVar |
| 54 | sv.Add(5.0) |
| 55 | sv.Add(1.0) |
| 56 | sv.Add(9.0) |
| 57 | sv.Add(3.0) |
| 58 | |
| 59 | assert.InDelta(t, 1.0, sv.Min(), 1e-9, |
| 60 | "Min should return the smallest value ever passed to Add") |
| 61 | assert.InDelta(t, 9.0, sv.Max(), 1e-9, |
| 62 | "Max should return the largest value ever passed to Add") |
| 63 | } |
| 64 | |
| 65 | // TestSpec_PublicAPI_Mean validates that Mean returns the arithmetic mean |
| 66 | // as described in the package README.md. |