You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kratos/pkg/stat/metric/reduce_test.go

18 lines
350 B

6 years ago
package metric
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCount(t *testing.T) {
opts := PointGaugeOpts{Size: 10}
pointGauge := NewPointGauge(opts)
for i := 0; i < opts.Size; i++ {
pointGauge.Add(int64(i))
}
result := pointGauge.Reduce(Count)
assert.Equal(t, float64(10), result, "validate count of pointGauge")
}