package artnet_test import ( "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) func TestGoodArtCommandUnmarshal(t *testing.T) { tests := []struct { Name string Data []byte Expected *artnet.ArtCommand }{} for _, test := range tests { t.Run(test.Name, func(t *testing.T) { got := &artnet.ArtCommand{} err := got.UnmarshalBinary(test.Data) if err != nil { t.Fatalf("failed to Unmarshal ArtCommand: %s", err) } diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtCommand{})) if diff != "" { t.Fatalf("ArtCommand does not match\n%s", diff) } }) } } func BenchmarkArtCommandMarshalBinary(b *testing.B) { data := artnet.ArtCommand{} for b.Loop() { _, err := data.MarshalBinary() if err != nil { b.Fatalf("failed to encode ArtCommand: %s", err) } } }