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

19 lines
299 B
Go

package metric
import (
"math/rand"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCounter(t *testing.T) {
counter := NewCounter(CounterOpts{})
count := rand.Intn(100)
for i := 0; i < count; i++ {
counter.Add(1)
}
val := counter.Value()
assert.Equal(t, val, int64(count))
}