1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

#68 string to float64

This commit is contained in:
Tao Wen
2017-06-20 16:20:56 +08:00
parent 2ea4d48e1f
commit 086001225d
2 changed files with 37 additions and 0 deletions

View File

@ -71,3 +71,17 @@ func Test_float_to_float32(t *testing.T) {
should.Nil(jsoniter.UnmarshalFromString(`1.23`, &val))
should.Equal(float32(1.23), val)
}
func Test_string_to_float64(t *testing.T) {
should := require.New(t)
var val float64
should.Nil(jsoniter.UnmarshalFromString(`"100"`, &val))
should.Equal(float64(100), val)
}
func Test_float_to_float64(t *testing.T) {
should := require.New(t)
var val float64
should.Nil(jsoniter.UnmarshalFromString(`1.23`, &val))
should.Equal(float64(1.23), val)
}