MCPcopy
hub / github.com/grafana/tempo / TestStatistic

Function TestStatistic

pkg/usagestats/stats_test.go:137–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestStatistic(t *testing.T) {
138 s := NewStatistics("test_stats")
139 s.Record(100)
140 s.Record(200)
141 s.Record(300)
142 v := s.Value()
143 require.Equal(t, float64(100), v["min"])
144 require.Equal(t, float64(300), v["max"])
145 require.Equal(t, int64(3), v["count"])
146 require.Equal(t, float64(100+200+300)/3, v["avg"])
147 require.Equal(t, float64(81.64965809277261), v["stddev"])
148 require.Equal(t, float64(6666.666666666667), v["stdvar"])
149}
150
151func TestWordCounter(t *testing.T) {
152 w := NewWordCounter("test_words_count")

Callers

nothing calls this directly

Calls 4

RecordMethod · 0.95
ValueMethod · 0.95
NewStatisticsFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected