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)
| 31 | // |
| 32 | // Specification: "Add: Adds one observation" |
| 33 | func 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. |