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

Function TestStatVar_OddCount

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

Source from the content-addressed store, hash-verified

50}
51
52func TestStatVar_OddCount(t *testing.T) {
53 var s StatVar
54 // [1, 3, 5] — odd number of values
55 for _, v := range []float64{5, 1, 3} {
56 s.Add(v)
57 }
58
59 assert.Equal(t, 3, s.Count(), "odd: count should be 3")
60 assert.InDelta(t, 1.0, s.Min(), 1e-9, "odd: min should be 1")
61 assert.InDelta(t, 5.0, s.Max(), 1e-9, "odd: max should be 5")
62 assert.InDelta(t, 3.0, s.Mean(), 1e-9, "odd: mean should be 3")
63 assert.InDelta(t, 3.0, s.Median(), 1e-9, "odd: median of [1,3,5] should be 3")
64}
65
66func TestStatVar_EvenCount(t *testing.T) {
67 var s StatVar

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected