diff --git a/address_test.go b/address_test.go index 2ad9925..68d395b 100644 --- a/address_test.go +++ b/address_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -924,7 +925,7 @@ func TestGoodArtAddressUnmarshal(t *testing.T) { t.Fatalf("failed to Unmarshal ArtAddress: %s", err) } - diff := cmp.Diff(test.Expected, got) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtAddress{})) if diff != "" { t.Fatalf("ArtAddress does not match\n%s", diff) } diff --git a/command_test.go b/command_test.go index 6791f77..750eb98 100644 --- a/command_test.go +++ b/command_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtCommandUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtCommand: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtCommand does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtCommand{})) + if diff != "" { + t.Fatalf("ArtCommand does not match\n%s", diff) } }) } diff --git a/datarequest_test.go b/datarequest_test.go index cff147c..9dbf75f 100644 --- a/datarequest_test.go +++ b/datarequest_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtDataRequestUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtDataRequest: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtDataRequest does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtDataRequest{})) + if diff != "" { + t.Fatalf("ArtDataRequest does not match\n%s", diff) } }) } diff --git a/diagdata_test.go b/diagdata_test.go index 3492a5c..a5a845b 100644 --- a/diagdata_test.go +++ b/diagdata_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtDiagDataUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtDiagData: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtDiagData does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtDiagData{})) + if diff != "" { + t.Fatalf("ArtDiagData does not match\n%s", diff) } }) } diff --git a/dmx_test.go b/dmx_test.go index 4bd0f74..e0b2ba6 100644 --- a/dmx_test.go +++ b/dmx_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "slices" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -49,7 +50,7 @@ func TestGoodArtDmx(t *testing.T) { } for _, test := range tests { - got := artnet.ArtDmx{} + got := &artnet.ArtDmx{} err := got.UnmarshalBinary(test.Data) @@ -57,26 +58,10 @@ func TestGoodArtDmx(t *testing.T) { t.Fatalf("failed to decode ArtDmx: %s", err) } - if got.Sequence != test.Expected.Sequence { - t.Fatalf("ArtDmx Sequence does not match got: %d expected: %d", got.Sequence, test.Expected.Sequence) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtDmx{})) + if diff != "" { + t.Fatalf("ArtDmx does not match\n%s", diff) } - - if got.Physical != test.Expected.Physical { - t.Fatalf("ArtDmx Physical does not match got: %d expected: %d", got.Physical, test.Expected.Physical) - } - - if got.SubUni != test.Expected.SubUni { - t.Fatalf("ArtDmx SubUni does not match got: %d expected: %d", got.SubUni, test.Expected.SubUni) - } - - if got.Net != test.Expected.Net { - t.Fatalf("ArtDmx Net does not match got: %d expected: %d", got.Net, test.Expected.Net) - } - - if !slices.Equal(got.Data, test.Expected.Data) { - t.Fatalf("ArtDmx Data does not match got: %+v expected: %+v", got.Data, test.Expected.Data) - } - } } diff --git a/ipprog_test.go b/ipprog_test.go index 678f881..9ceaed7 100644 --- a/ipprog_test.go +++ b/ipprog_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -44,8 +45,9 @@ func TestGoodArtIpProgUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtIpProg: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtIpProg does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtIpProg{})) + if diff != "" { + t.Fatalf("ArtIpProg does not match\n%s", diff) } }) } diff --git a/ipprogreply_test.go b/ipprogreply_test.go index f7ac98e..e65b21f 100644 --- a/ipprogreply_test.go +++ b/ipprogreply_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtIpProgReplyUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtIpProgReply: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtIpProgReply does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtIpProgReply{})) + if diff != "" { + t.Fatalf("ArtIpProgReply does not match\n%s", diff) } }) } diff --git a/nzs_test.go b/nzs_test.go index 1aa6ea6..d75fa8b 100644 --- a/nzs_test.go +++ b/nzs_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtNzsUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtNzs: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtNzs does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtNzs{})) + if diff != "" { + t.Fatalf("ArtNzs does not match\n%s", diff) } }) } diff --git a/poll_test.go b/poll_test.go index e629a3a..746092f 100644 --- a/poll_test.go +++ b/poll_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -208,8 +209,9 @@ func TestGoodArtPollUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtPoll: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtPoll does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtPoll{})) + if diff != "" { + t.Fatalf("ArtPoll does not match\n%s", diff) } }) } diff --git a/pollreply_test.go b/pollreply_test.go index e0cdbdd..b282b81 100644 --- a/pollreply_test.go +++ b/pollreply_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtPollReplyUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtPollReply: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtPollReply does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtPollReply{})) + if diff != "" { + t.Fatalf("ArtPollReply does not match\n%s", diff) } }) } diff --git a/sync_test.go b/sync_test.go index 6509e4a..e85c5a4 100644 --- a/sync_test.go +++ b/sync_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtSyncUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtSync: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtSync does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtSync{})) + if diff != "" { + t.Fatalf("ArtSync does not match\n%s", diff) } }) } diff --git a/timecode_test.go b/timecode_test.go index 2e5aabd..478f345 100644 --- a/timecode_test.go +++ b/timecode_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -36,8 +37,9 @@ func TestGoodArtTimeCodeUnmarshal(t *testing.T) { t.Fatalf("failed to decode ArtTimeCode: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtTimeCode does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtTimeCode{})) + if diff != "" { + t.Fatalf("ArtTimeCode does not match\n%s", diff) } }) } diff --git a/todcontrol_test.go b/todcontrol_test.go index 4200a61..a71a478 100644 --- a/todcontrol_test.go +++ b/todcontrol_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -28,8 +29,9 @@ func TestGoodArtTodControlUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtTodControl: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtTodControl does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtTodControl{})) + if diff != "" { + t.Fatalf("ArtTodControl does not match\n%s", diff) } }) } diff --git a/todrequest_test.go b/todrequest_test.go index 3a0eb74..8e76648 100644 --- a/todrequest_test.go +++ b/todrequest_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -185,8 +186,9 @@ func TestGoodArtTodRequestUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtTodRequest: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtTodRequest does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtTodRequest{})) + if diff != "" { + t.Fatalf("ArtTodRequest does not match\n%s", diff) } }) } diff --git a/trigger_test.go b/trigger_test.go index 72dbd7e..13be1e1 100644 --- a/trigger_test.go +++ b/trigger_test.go @@ -1,9 +1,10 @@ package artnet_test import ( - "reflect" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/jwetzell/artnet-go" ) @@ -22,8 +23,9 @@ func TestGoodArtTriggerUnmarshal(t *testing.T) { if err != nil { t.Fatalf("failed to Unmarshal ArtTrigger: %s", err) } - if !reflect.DeepEqual(got, test.Expected) { - t.Fatalf("ArtTrigger does not match got: %+v expected: %+v", got, test.Expected) + diff := cmp.Diff(test.Expected, got, cmpopts.IgnoreUnexported(artnet.ArtTrigger{})) + if diff != "" { + t.Fatalf("ArtTrigger does not match\n%s", diff) } }) }