From cfd0f1680c2c553ff883ecd6e443b3bc67c6ebb2 Mon Sep 17 00:00:00 2001 From: Aumetra Weisman Date: Tue, 19 Mar 2024 15:58:20 +0100 Subject: [PATCH] Add `Stringer` test --- types/types_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/types_test.go b/types/types_test.go index 172a3ca9c..2a3fa9c90 100644 --- a/types/types_test.go +++ b/types/types_test.go @@ -5,9 +5,20 @@ import ( "math" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +func TestChecksumString(t *testing.T) { + // SHA-256 hash of "lucyna kushinada" + + hexRepr := "cd6ff9ff3faea9b3d0224a7e0d1133e6eae1b7800e8392441200056986c358a9" + rawBytes := []byte{0xCD, 0x6F, 0xF9, 0xFF, 0x3F, 0xAE, 0xA9, 0xB3, 0xD0, 0x22, 0x4A, 0x7E, 0x0D, 0x11, 0x33, 0xE6, 0xEA, 0xE1, 0xB7, 0x80, 0x0E, 0x83, 0x92, 0x44, 0x12, 0x00, 0x05, 0x69, 0x86, 0xC3, 0x58, 0xA9} + checksumRepr := Checksum(rawBytes).String() + + assert.Equal(t, hexRepr, checksumRepr) +} + func TestUint64JSON(t *testing.T) { var u Uint64