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/counter_test.go

18 lines
299 B

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