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.
19 lines
299 B
19 lines
299 B
6 years ago
|
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))
|
||
|
}
|