evcc-io/server/db/settings/settings_test.go
2022-10-23 13:27:49 +02:00

32 lines
528 B
Go

package settings
import (
"math"
"testing"
"github.com/stretchr/testify/assert"
)
func TestString(t *testing.T) {
v := "foo"
SetString("string", v)
res, err := String("string")
assert.Nil(t, err)
assert.Equal(t, v, res)
}
func TestInt(t *testing.T) {
v := int64(math.MaxInt64)
SetInt("int64", v)
res, err := Int("int64")
assert.Nil(t, err)
assert.Equal(t, v, res)
}
func TestFloat(t *testing.T) {
v := 3.141
SetFloat("float64", v)
res, err := Float("float64")
assert.Nil(t, err)
assert.Equal(t, v, res)
}