X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fmth_test.go;h=f3c5dfe702875bbde1a7d2b322b7dd91e10bac5a;hb=HEAD;hp=2c61c879f5ecff27e179e74d298ec15848336d29;hpb=9fbc648a2821d9a6e0de6352d9adb40f98f1723a;p=nncp.git diff --git a/src/mth_test.go b/src/mth_test.go index 2c61c87..fcdff17 100644 --- a/src/mth_test.go +++ b/src/mth_test.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2021 Sergey Matveev +Copyright (C) 2016-2023 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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() } }