func BenchmarkMojomToVdlTranscoding(b *testing.B) { data := mojomBytesCustomer() t := vdl.TypeOf(customer) for i := 0; i < b.N; i++ { var c Customer transcoder.ValueFromMojo(&c, data, t) } }
func TestVomToMojoToVom(t *testing.T) { for _, test := range testCases { testName := test.Name + " vom->mojo->vom" data, err := transcoder.ToMojom(test.VdlValue) if err != nil { t.Errorf("%s: error in VomToMojo: %v", testName, err) continue } var out interface{} if err := transcoder.ValueFromMojo(&out, data, vdl.TypeOf(test.VdlValue)); err != nil { t.Errorf("%s: error in MojoToVom: %v (was transcoding from %x)", testName, err, data) continue } if got, want := out, test.VdlValue; !reflect.DeepEqual(got, want) { t.Errorf("%s: result doesn't match expectation. got %#v, but want %#v", testName, got, want) } } }