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

Function TestSpec_PublicAPI_EmptyBehavior

pkg/stats/spec_test.go:19–27  ·  view source on GitHub ↗

TestSpec_PublicAPI_EmptyBehavior validates that an empty StatVar returns documented zero values as described in the package README.md. Specification: - Min: "Returns the minimum observed value (or 0 if empty)" - Max: "Returns the maximum observed value (or 0 if empty)" - Mean: "Returns the arithmet

(t *testing.T)

Source from the content-addressed store, hash-verified

17// - Max: "Returns the maximum observed value (or 0 if empty)"
18// - Mean: "Returns the arithmetic mean (or 0 if empty)"
19func TestSpec_PublicAPI_EmptyBehavior(t *testing.T) {
20 var sv StatVar
21
22 assert.Equal(t, 0, sv.Count(), "Count should return 0 for an empty StatVar")
23 assert.InDelta(t, 0.0, sv.Min(), 1e-9, "Min should return 0 when no observations have been added")
24 assert.InDelta(t, 0.0, sv.Max(), 1e-9, "Max should return 0 when no observations have been added")
25 assert.InDelta(t, 0.0, sv.Mean(), 1e-9, "Mean should return 0 when no observations have been added")
26 assert.InDelta(t, 0.0, sv.Median(), 1e-9, "Median should return 0 when no observations have been added")
27}
28
29// TestSpec_PublicAPI_Add validates that each Add call records exactly one
30// observation as described in the package README.md.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected