1
0
mirror of https://github.com/json-iterator/go.git synced 2025-11-29 22:47:28 +02:00

fix tests

This commit is contained in:
Tao Wen
2017-02-12 22:49:45 +08:00
parent 9670a03165
commit 9d1feb5431
4 changed files with 20 additions and 25 deletions

View File

@@ -221,12 +221,11 @@ func Test_write_object(t *testing.T) {
should.Equal("{\n \"hello\":1,\n \"world\":2\n}", buf.String())
}
type TestObj struct {
Field1 string
Field2 uint64
}
func Benchmark_jsoniter_object(b *testing.B) {
type TestObj struct {
Field1 string
Field2 uint64
}
for n := 0; n < b.N; n++ {
iter := ParseString(`{"field1": "1", "field2": 2}`)
obj := TestObj{}
@@ -244,6 +243,10 @@ func Benchmark_jsoniter_object(b *testing.B) {
}
func Benchmark_json_object(b *testing.B) {
type TestObj struct {
Field1 string
Field2 uint64
}
for n := 0; n < b.N; n++ {
result := TestObj{}
json.Unmarshal([]byte(`{"field1": "1", "field2": 2}`), &result)