1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-26 03:52:12 +02:00
kratos/pkg/stat/metric/reduce_test.go
2019-04-12 21:07:26 +08:00

18 lines
350 B
Go

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")
}