mirror of
https://github.com/json-iterator/go.git
synced 2025-04-01 21:24:21 +02:00
add test for scientific float
This commit is contained in:
parent
cfffa29c8a
commit
d75b539bad
@ -158,6 +158,19 @@ func Test_read_float64_cursor(t *testing.T) {
|
|||||||
should.Equal(float64(2), iter.Read())
|
should.Equal(float64(2), iter.Read())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_read_float_scientific(t *testing.T) {
|
||||||
|
should := require.New(t)
|
||||||
|
var obj interface{}
|
||||||
|
should.Nil(UnmarshalFromString(`1e1`, &obj))
|
||||||
|
should.Equal(float64(10), obj)
|
||||||
|
should.Nil(json.Unmarshal([]byte(`1e1`), &obj))
|
||||||
|
should.Equal(float64(10), obj)
|
||||||
|
should.Nil(UnmarshalFromString(`1.0e1`, &obj))
|
||||||
|
should.Equal(float64(10), obj)
|
||||||
|
should.Nil(json.Unmarshal([]byte(`1.0e1`), &obj))
|
||||||
|
should.Equal(float64(10), obj)
|
||||||
|
}
|
||||||
|
|
||||||
func Benchmark_jsoniter_float(b *testing.B) {
|
func Benchmark_jsoniter_float(b *testing.B) {
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
input := []byte(`1.1123,`)
|
input := []byte(`1.1123,`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user