From e1d9fc80583b02d0925ad69ef95f2e395f917f16 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Fri, 21 Jun 2019 23:16:58 +0300 Subject: [PATCH] Use testify in tests --- tz/hash_test.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tz/hash_test.go b/tz/hash_test.go index c79dcc5..e52ed90 100644 --- a/tz/hash_test.go +++ b/tz/hash_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" ) -const benchDataSize = 1000000 +const benchDataSize = 100000 var testCases = []struct { input []byte @@ -36,10 +36,8 @@ func TestHash(t *testing.T) { d.Reset() _, _ = d.Write(tc.input) sum := d.checkSum() - hash := hex.EncodeToString(sum[:]) - if hash != tc.hash { - t.Errorf("expected (%s), got (%s)", tc.hash, hash) - } + + require.Equal(t, tc.hash, hex.EncodeToString(sum[:])) } }) @@ -49,10 +47,8 @@ func TestHash(t *testing.T) { d.Reset() _, _ = d.Write(tc.input) sum := d.checkSum() - hash := hex.EncodeToString(sum[:]) - if hash != tc.hash { - t.Errorf("expected (%s), got (%s)", tc.hash, hash) - } + + require.Equal(t, tc.hash, hex.EncodeToString(sum[:])) } }) }