mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-10 00:29:01 +02:00
24 lines
388 B
Go
24 lines
388 B
Go
package metric
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGaugeAdd(t *testing.T) {
|
|
gauge := NewGauge(GaugeOpts{})
|
|
gauge.Add(100)
|
|
gauge.Add(-50)
|
|
val := gauge.Value()
|
|
assert.Equal(t, val, int64(50))
|
|
}
|
|
|
|
func TestGaugeSet(t *testing.T) {
|
|
gauge := NewGauge(GaugeOpts{})
|
|
gauge.Add(100)
|
|
gauge.Set(50)
|
|
val := gauge.Value()
|
|
assert.Equal(t, val, int64(50))
|
|
}
|