| 22 | } |
| 23 | |
| 24 | func TestStatVar_SingleObservation(t *testing.T) { |
| 25 | var s StatVar |
| 26 | s.Add(42.0) |
| 27 | |
| 28 | assert.Equal(t, 1, s.Count(), "single: count should be 1") |
| 29 | assert.InDelta(t, 42.0, s.Min(), 1e-9, "single: min should be 42") |
| 30 | assert.InDelta(t, 42.0, s.Max(), 1e-9, "single: max should be 42") |
| 31 | assert.InDelta(t, 42.0, s.Mean(), 1e-9, "single: mean should be 42") |
| 32 | assert.InDelta(t, 0.0, s.SampleVariance(), 1e-9, "single: sample variance should be 0 (needs >=2)") |
| 33 | assert.InDelta(t, 42.0, s.Median(), 1e-9, "single: median should be 42") |
| 34 | } |
| 35 | |
| 36 | func TestStatVar_TwoObservations(t *testing.T) { |
| 37 | var s StatVar |