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

Function TestStatVar_TwoObservations

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

Source from the content-addressed store, hash-verified

34}
35
36func TestStatVar_TwoObservations(t *testing.T) {
37 var s StatVar
38 s.Add(10.0)
39 s.Add(20.0)
40
41 assert.Equal(t, 2, s.Count(), "two: count should be 2")
42 assert.InDelta(t, 10.0, s.Min(), 1e-9, "two: min should be 10")
43 assert.InDelta(t, 20.0, s.Max(), 1e-9, "two: max should be 20")
44 assert.InDelta(t, 15.0, s.Mean(), 1e-9, "two: mean should be 15")
45 // Sample variance: 50 / (2-1) = 50
46 assert.InDelta(t, 50.0, s.SampleVariance(), 1e-9, "two: sample variance should be 50")
47 assert.InDelta(t, math.Sqrt(50), s.SampleStdDev(), 1e-9, "two: sample stddev should be sqrt(50)")
48 // Median of [10, 20] → (10+20)/2 = 15
49 assert.InDelta(t, 15.0, s.Median(), 1e-9, "two: median should be 15")
50}
51
52func TestStatVar_OddCount(t *testing.T) {
53 var s StatVar

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected