TestSpec_PublicAPI_EmptyBehavior validates that an empty StatVar returns documented zero values as described in the package README.md. Specification: - Min: "Returns the minimum observed value (or 0 if empty)" - Max: "Returns the maximum observed value (or 0 if empty)" - Mean: "Returns the arithmet
(t *testing.T)
| 17 | // - Max: "Returns the maximum observed value (or 0 if empty)" |
| 18 | // - Mean: "Returns the arithmetic mean (or 0 if empty)" |
| 19 | func TestSpec_PublicAPI_EmptyBehavior(t *testing.T) { |
| 20 | var sv StatVar |
| 21 | |
| 22 | assert.Equal(t, 0, sv.Count(), "Count should return 0 for an empty StatVar") |
| 23 | assert.InDelta(t, 0.0, sv.Min(), 1e-9, "Min should return 0 when no observations have been added") |
| 24 | assert.InDelta(t, 0.0, sv.Max(), 1e-9, "Max should return 0 when no observations have been added") |
| 25 | assert.InDelta(t, 0.0, sv.Mean(), 1e-9, "Mean should return 0 when no observations have been added") |
| 26 | assert.InDelta(t, 0.0, sv.Median(), 1e-9, "Median should return 0 when no observations have been added") |
| 27 | } |
| 28 | |
| 29 | // TestSpec_PublicAPI_Add validates that each Add call records exactly one |
| 30 | // observation as described in the package README.md. |