2024-07-20 00:20:28 +02:00
|
|
|
package results // import nocternity.net/gomonop/pkg/results
|
2024-07-20 00:05:58 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStatusDefaultOK(t *testing.T) {
|
|
|
|
var s Status
|
|
|
|
assert.Equal(t, StatusOK, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestStatusToString(t *testing.T) {
|
|
|
|
assert.Equal(t, "OK", StatusOK.String())
|
|
|
|
assert.Equal(t, "WARNING", StatusWarning.String())
|
|
|
|
assert.Equal(t, "ERROR", StatusCritical.String())
|
|
|
|
assert.Equal(t, "UNKNOWN", StatusUnknown.String())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestStatusToInt(t *testing.T) {
|
|
|
|
assert.Equal(t, 0, int(StatusOK))
|
|
|
|
assert.Equal(t, 1, int(StatusWarning))
|
|
|
|
assert.Equal(t, 2, int(StatusCritical))
|
|
|
|
assert.Equal(t, 3, int(StatusUnknown))
|
|
|
|
}
|