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

Function TestSpec_PublicAPI_Add

pkg/stats/spec_test.go:33–44  ·  view source on GitHub ↗

TestSpec_PublicAPI_Add validates that each Add call records exactly one observation as described in the package README.md. Specification: "Add: Adds one observation"

(t *testing.T)

Source from the content-addressed store, hash-verified

31//
32// Specification: "Add: Adds one observation"
33func TestSpec_PublicAPI_Add(t *testing.T) {
34 var sv StatVar
35
36 sv.Add(10.0)
37 assert.Equal(t, 1, sv.Count(), "Count should be 1 after one Add call")
38
39 sv.Add(20.0)
40 assert.Equal(t, 2, sv.Count(), "Count should be 2 after two Add calls")
41
42 sv.Add(30.0)
43 assert.Equal(t, 3, sv.Count(), "Count should be 3 after three Add calls")
44}
45
46// TestSpec_PublicAPI_MinMax validates that Min and Max track the extreme
47// observed values as described in the package README.md.

Callers

nothing calls this directly

Calls 2

AddMethod · 0.95
CountMethod · 0.95

Tested by

no test coverage detected