X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=blobdiff_plain;f=src%2Fmth_test.go;h=fcdff1752c2476abb369d1ec9106f931469dd22d;hp=6d6b5c3bdfae407c364cb35aa0111a4f7e010a8b;hb=d386e5b28dc603ac4ffac10337f322e15bc92d80;hpb=4ba3188c55713c2b3a2326ab6b670606f27a13f5 diff --git a/src/mth_test.go b/src/mth_test.go index 6d6b5c3..fcdff17 100644 --- a/src/mth_test.go +++ b/src/mth_test.go @@ -49,13 +49,13 @@ func TestMTHSeqSymmetric(t *testing.T) { if _, err := mth.PreaddFrom(bytes.NewReader(data), "", false); err != nil { panic(err) } - if bytes.Compare(hsh0, mth.Sum(nil)) != 0 { + if !bytes.Equal(hsh0, mth.Sum(nil)) { return false } mth = MTHSeqNew(0, 0) mth.Write(data) - if bytes.Compare(hsh0, mth.Sum(nil)) != 0 { + if !bytes.Equal(hsh0, mth.Sum(nil)) { return false } @@ -65,7 +65,7 @@ func TestMTHSeqSymmetric(t *testing.T) { panic(err) } hsh00 := mth.Sum(nil) - if bytes.Compare(hsh0, hsh00) == 0 { + if bytes.Equal(hsh0, hsh00) { return false } @@ -76,17 +76,13 @@ func TestMTHSeqSymmetric(t *testing.T) { if _, err := mth.PreaddFrom(bytes.NewReader(data), "", false); err != nil { panic(err) } - if bytes.Compare(hsh00, mth.Sum(nil)) != 0 { + if !bytes.Equal(hsh00, mth.Sum(nil)) { return false } mth = MTHSeqNew(0, 0) mth.Write(data) - if bytes.Compare(hsh00, mth.Sum(nil)) != 0 { - return false - } - - return true + return bytes.Equal(hsh00, mth.Sum(nil)) } if err := quick.Check(f, nil); err != nil { t.Error(err) @@ -110,7 +106,7 @@ func TestMTHSeqAndFatEqual(t *testing.T) { if _, err := io.Copy(seq, bytes.NewReader(data)); err != nil { panic(err) } - return bytes.Compare(hshFat, seq.Sum(nil)) == 0 + return bytes.Equal(hshFat, seq.Sum(nil)) } if err := quick.Check(f, nil); err != nil { t.Error(err) @@ -128,7 +124,7 @@ func TestMTHNull(t *testing.T) { if _, err := seq.Write(nil); err != nil { t.Error(err) } - if bytes.Compare(hshFat, seq.Sum(nil)) != 0 { + if !bytes.Equal(hshFat, seq.Sum(nil)) { t.FailNow() } }