evcc-io/server/http_handler_test.go
2023-01-19 19:01:22 +01:00

17 lines
291 B
Go

package server
import (
"math"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNaNInf(t *testing.T) {
c := map[string]any{
"foo": math.NaN(),
"bar": math.Inf(0),
}
encodeFloats(c)
assert.Equal(t, map[string]any{"foo": nil, "bar": nil}, c, "NaN not encoded as nil")
}