Skip to content

Commit cfd0f16

Browse files
committed
Add Stringer test
1 parent f4d0a92 commit cfd0f16

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

types/types_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,20 @@ import (
55
"math"
66
"testing"
77

8+
"github.com/stretchr/testify/assert"
89
"github.com/stretchr/testify/require"
910
)
1011

12+
func TestChecksumString(t *testing.T) {
13+
// SHA-256 hash of "lucyna kushinada"
14+
15+
hexRepr := "cd6ff9ff3faea9b3d0224a7e0d1133e6eae1b7800e8392441200056986c358a9"
16+
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}
17+
checksumRepr := Checksum(rawBytes).String()
18+
19+
assert.Equal(t, hexRepr, checksumRepr)
20+
}
21+
1122
func TestUint64JSON(t *testing.T) {
1223
var u Uint64
1324

0 commit comments

Comments
 (0)