27 lines
525 B
Go
27 lines
525 B
Go
|
package perfdata // import nocternity.net/gomonop/pkg/perfdata
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestUnitsToString(t *testing.T) {
|
||
|
checks := map[UnitOfMeasurement]string{
|
||
|
UomNone: "",
|
||
|
UomSeconds: "s",
|
||
|
UomPercent: "%",
|
||
|
UomBytes: "B",
|
||
|
UomKilobytes: "KB",
|
||
|
UomMegabytes: "MB",
|
||
|
UomGigabytes: "GB",
|
||
|
UomTerabytes: "TB",
|
||
|
UomCounter: "c",
|
||
|
}
|
||
|
|
||
|
for u, s := range checks {
|
||
|
result := u.String()
|
||
|
assert.Equal(t, s, result, "Expected '%s', got '%s'", s, result)
|
||
|
}
|
||
|
}
|