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

Function TestSpec_PublicAPI_StdDev

pkg/stats/spec_test.go:102–110  ·  view source on GitHub ↗

TestSpec_PublicAPI_StdDev validates that StdDev and SampleStdDev equal the square root of their respective variances as described in the README.md. Specification: - StdDev: "Returns population standard deviation" - SampleStdDev: "Returns sample standard deviation"

(t *testing.T)

Source from the content-addressed store, hash-verified

100// - StdDev: "Returns population standard deviation"
101// - SampleStdDev: "Returns sample standard deviation"
102func TestSpec_PublicAPI_StdDev(t *testing.T) {
103 var sv StatVar
104 for _, v := range []float64{2, 4, 4, 4, 5, 5, 7, 9} {
105 sv.Add(v)
106 }
107
108 assert.InDelta(t, math.Sqrt(sv.SampleVariance()), sv.SampleStdDev(), 1e-9,
109 "SampleStdDev should equal sqrt(SampleVariance)")
110}
111
112// TestSpec_PublicAPI_Median_OddCount validates that Median returns the middle
113// value for an odd-count set as described in the README.md.

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
SampleVarianceMethod · 0.95
SampleStdDevMethod · 0.95

Tested by

no test coverage detected