Fix test case

This commit is contained in:
Masaaki Goshima 2020-04-24 20:55:21 +09:00
parent 7bcc2071e9
commit 43e676350c
1 changed files with 5 additions and 3 deletions

View File

@ -75,9 +75,11 @@ func Test_Decoder(t *testing.T) {
assertEq(t, "string", "hello", v)
})
t.Run("float32", func(t *testing.T) {
var v float32
assertErr(t, json.Unmarshal([]byte(`3.14`), &v))
assertEq(t, "float32", float32(3.14), v)
var v struct {
F float32
}
assertErr(t, json.Unmarshal([]byte(`{"f": 3.14}`), &v))
assertEq(t, "float32", float32(3.14), v.F)
})
t.Run("float64", func(t *testing.T) {
var v float64