lib: Use bytes.Equal instead of bytes.Compare where possible
This commit is contained in:
committed by
Audrius Butkevicius
parent
b6f32b6e45
commit
f5f0e46016
@@ -97,7 +97,7 @@ func TestRequest(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if bytes.Compare(bs, []byte("foobar")) != 0 {
|
||||
if !bytes.Equal(bs, []byte("foobar")) {
|
||||
t.Errorf("Incorrect data from request: %q", string(bs))
|
||||
}
|
||||
|
||||
@@ -407,13 +407,13 @@ func TestClusterConfig(t *testing.T) {
|
||||
if l := len(r.Devices); l != 2 {
|
||||
t.Errorf("Incorrect number of devices %d != 2", l)
|
||||
}
|
||||
if id := r.Devices[0].ID; bytes.Compare(id, device1[:]) != 0 {
|
||||
if id := r.Devices[0].ID; !bytes.Equal(id, device1[:]) {
|
||||
t.Errorf("Incorrect device ID %x != %x", id, device1)
|
||||
}
|
||||
if r.Devices[0].Flags&protocol.FlagIntroducer == 0 {
|
||||
t.Error("Device1 should be flagged as Introducer")
|
||||
}
|
||||
if id := r.Devices[1].ID; bytes.Compare(id, device2[:]) != 0 {
|
||||
if id := r.Devices[1].ID; !bytes.Equal(id, device2[:]) {
|
||||
t.Errorf("Incorrect device ID %x != %x", id, device2)
|
||||
}
|
||||
if r.Devices[1].Flags&protocol.FlagIntroducer != 0 {
|
||||
@@ -427,13 +427,13 @@ func TestClusterConfig(t *testing.T) {
|
||||
if l := len(r.Devices); l != 2 {
|
||||
t.Errorf("Incorrect number of devices %d != 2", l)
|
||||
}
|
||||
if id := r.Devices[0].ID; bytes.Compare(id, device1[:]) != 0 {
|
||||
if id := r.Devices[0].ID; !bytes.Equal(id, device1[:]) {
|
||||
t.Errorf("Incorrect device ID %x != %x", id, device1)
|
||||
}
|
||||
if r.Devices[0].Flags&protocol.FlagIntroducer == 0 {
|
||||
t.Error("Device1 should be flagged as Introducer")
|
||||
}
|
||||
if id := r.Devices[1].ID; bytes.Compare(id, device2[:]) != 0 {
|
||||
if id := r.Devices[1].ID; !bytes.Equal(id, device2[:]) {
|
||||
t.Errorf("Incorrect device ID %x != %x", id, device2)
|
||||
}
|
||||
if r.Devices[1].Flags&protocol.FlagIntroducer != 0 {
|
||||
|
||||
Reference in New Issue
Block a user