MCPcopy Create free account
hub / github.com/github/gh-aw / TestStatVar_SingleObservation

Function TestStatVar_SingleObservation

pkg/stats/statvar_test.go:24–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22}
23
24func 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
36func TestStatVar_TwoObservations(t *testing.T) {
37 var s StatVar

Callers

nothing calls this directly

Calls 7

AddMethod · 0.95
CountMethod · 0.95
MinMethod · 0.95
MaxMethod · 0.95
MeanMethod · 0.95
SampleVarianceMethod · 0.95
MedianMethod · 0.95

Tested by

no test coverage detected