@@ -19,6 +19,20 @@ import (
1919 "testing"
2020)
2121
22+ var encodetestBsonD D
23+
24+ func init () {
25+ b , err := Marshal (encodetestInstance )
26+ if err != nil {
27+ panic (fmt .Sprintf ("error marshling struct: %v" , err ))
28+ }
29+
30+ err = Unmarshal (b , & encodetestBsonD )
31+ if err != nil {
32+ panic (fmt .Sprintf ("error unmarshaling BSON: %v" , err ))
33+ }
34+ }
35+
2236type encodetest struct {
2337 Field1String string
2438 Field1Int64 int64
@@ -195,21 +209,8 @@ func BenchmarkMarshal(b *testing.B) {
195209 value : nestedInstance ,
196210 },
197211 {
198- desc : "simple D" ,
199- value : D {
200- {"field1String" , "foo" },
201- {"field1Int64" , int64 (1 )},
202- {"field1Float64" , float64 (3.0 )},
203- {"field2String" , "bar" },
204- {"field2Int64" , int64 (2 )},
205- {"field2Float64" , float64 (3.1 )},
206- {"field3String" , "baz" },
207- {"field3Int64" , int64 (3 )},
208- {"field3Float64" , float64 (3.14 )},
209- {"field4String" , "qux" },
210- {"field4Int64" , int64 (4 )},
211- {"field4Float64" , float64 (3.141 )},
212- },
212+ desc : "simple D" ,
213+ value : encodetestBsonD ,
213214 },
214215 {
215216 desc : "deep_bson.json.gz" ,
0 commit comments