Files
windows_exporter/internal/utils/counter_test.go
Jan-Otto Kröpke e6a15d4ec4 chore: Remove registry based perfdata collector (#1742)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2024-11-17 21:51:12 +01:00

27 lines
486 B
Go

//go:build windows
package utils_test
import (
"math"
"testing"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/stretchr/testify/assert"
)
func TestCounter(t *testing.T) {
t.Parallel()
c := utils.NewCounter(0)
assert.Equal(t, 0.0, c.Value()) //nolint:testifylint
c.AddValue(1)
assert.Equal(t, 1.0, c.Value()) //nolint:testifylint
c.AddValue(math.MaxUint32)
assert.Equal(t, float64(math.MaxUint32)+1.0, c.Value()) //nolint:testifylint
}